Tomcat 7 SSL and getDesiredSchemeFor problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tomcat 7 SSL and getDesiredSchemeFor problem

Sandor Feher
This post was updated on .
Hi,

I don't know is it the appropriate channel I should ask but I hope somebody can give me a pointer.
The sympthom is that super.getDesiredSchemeFor(pageClass) always returns HTTP regardless https or http is in the url.
If I force Scheme.HTTPS then everything works fine.

Wicket 6.20

TIA., Sandor

-------------------------------------------------------------------------------------------------------------
server.xml looks like this:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
                           enableLookups="false"
               redirectPort="443" />
    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
                           enableLookups="false"
               redirectPort="443" />
   

    <Connector port="443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               SSLCertificateFile="C:\apache-tomcat-7.0.64\conf\wildcard_domai_com.crt"
               SSLCertificateKeyFile="C:\apache-tomcat-7.0.64\conf\wildcard_domain_com.key"
               clientAuth="false" sslProtocol="TLS" />

    <Connector port="8009" protocol="AJP/1.3" redirectPort="443" />


My Application's relevant part is this:

setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig()) {

                @Override
                protected Scheme getDesiredSchemeFor(Class<? extends IRequestablePage> pageClass) {
                    if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) {
                        LOG.info("Dev mode, always use HTTP");
                        return Scheme.HTTP;
                    } else {
                       
                        Scheme sm=super.getDesiredSchemeFor(pageClass);
                        sm=Scheme.HTTPS;
                        LOG.info("not in development mode "+sm.name());
                        return sm;
                    }
                }

            });


             
Reply | Threaded
Open this post in threaded view
|

Re: Tomcat 7 SSL and getDesiredSchemeFor problem

Sven Meier
Hi,

 > The sympthom is that super.getDesiredSchemeFor(pageClass) always
returns HTTP
 > regardless https or http is in the url.
 >
 > Scheme sm=super.getDesiredSchemeFor(pageClass);

did you annotate your pageClass with RequireHttps? Whether HTTPS is
desired, does not depend on the scheme of the incoming url.

Regards
Sven

On 17.09.2015 11:50, Sandor Feher wrote:

> Hi,
>
> I don't know is it the appropriate channel I should ask but I hope somebody
> can give me a pointer.
> The sympthom is that super.getDesiredSchemeFor(pageClass) always returns
> HTTP regardless https or http is in the url.
> If I force Scheme.HTTPS then everything works fine.
>
>
> TIA., Sandor
>
> -------------------------------------------------------------------------------------------------------------
> servlet.xml looks like this:
>
> <Connector port="8080" protocol="HTTP/1.1"
>                 connectionTimeout="20000"
>   enableLookups="false"
>                 redirectPort="443" />
>      <Connector port="80" protocol="HTTP/1.1"
>                 connectionTimeout="20000"
>   enableLookups="false"
>                 redirectPort="443" />
>      <Connector executor="tomcatThreadPool"
>                 port="8080" protocol="HTTP/1.1"
>                 connectionTimeout="20000"
>                 redirectPort="443" />
>
>      <Connector port="443"
> protocol="org.apache.coyote.http11.Http11AprProtocol"
>                 maxThreads="150" SSLEnabled="true" scheme="https"
> secure="true"
>                
> SSLCertificateFile="C:\apache-tomcat-7.0.64\conf\wildcard_hok-plastic_com.crt"
>                
> SSLCertificateKeyFile="C:\apache-tomcat-7.0.64\conf\wildcard_hok-plastic_com.key"
>                 clientAuth="false" sslProtocol="TLS" />
>
>      <Connector port="8009" protocol="AJP/1.3" redirectPort="443" />
>
>
> My Application's relevant part is this:
>
> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
> HttpsConfig()) {
>
>                  @Override
>                  protected Scheme getDesiredSchemeFor(Class<? extends
> IRequestablePage> pageClass) {
>                      if (getConfigurationType() ==
> RuntimeConfigurationType.DEVELOPMENT) {
>                          LOG.info("Dev mode, always use HTTP");
>                          return Scheme.HTTP;
>                      } else {
>                          
>                          Scheme sm=super.getDesiredSchemeFor(pageClass);
>                          sm=Scheme.HTTPS;
>                          LOG.info("not in development mode "+sm.name());
>                          return sm;
>                      }
>                  }
>
>              });
>
>
>              
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Tomcat-7-SSL-and-getDesiredSchemeFor-problem-tp4671980.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Tomcat 7 SSL and getDesiredSchemeFor problem

Sandor Feher
Hi,

No I did not. I would like to get both method (http and https) accessible.
There is no proxy used.

s