wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: Balancer + HTTPS
Date Mon, 15 May 2017 06:56:07 GMT
Hi,

Put a breakpoint at org.apache.wicket.request.Url#getProtocol() and see
what it returns.
I guess the redirect is an absolute url and that's why it breaks.
See org.apache.wicket.protocol.http.servlet.ServletWebResponse#sendRedirect

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 15, 2017 at 5:01 AM, Marcel Barbosa Pinto <
marcel.power@gmail.com> wrote:

> Hi,
>
> I am using a balancer which sends the X-Forwarded-Proto header to my Wicket
> application.
>
> I`ve added the following filters:
>
>  getFilterFactoryManager()
> >             .addSecuredRemoteAddressRequestWrapperFactory(null)
> >             .addXForwardedRequestWrapperFactory(null);
> >
>
> And the HttpsMapper:
>
> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
> > HttpsConfig())
> >
>
>
> And the following init-param into web.xml
>
> <init-param>
> >           <param-name>protocolHeader</param-name>
> >           <param-value>X-Forwarded-Proto</param-value>
> >  </init-param>
> >
>
>
> When I debug I can see that the header is working inside a
> RequestCycleListener
>
> HttpServletRequest req = (HttpServletRequest)
> > cycle.getRequest().getContainerRequest();
> > System.out.println("-->" + req.getScheme() + " ==" +
> > req.getHeader("X-Forwarded-Proto");
> >
>
>
> The problem occurs when some versioned page is created and wicket redirect
> it to the same URL but with the HTTP:// instead, for example:
>
> *https://*www.wicket.com/statefullPage
> -> Response header: 302 (Location: *http://*www.wicket.com/
> statefullPage*?1*
> )
>
> If I change it back to HTTPS it works:
>
> *https://*www.wicket.com/statefullPage
> *?1*
> *-> *Response 200 OK
>
> I believe that in some redirection logic the original schema is being lost
> somehow, during page versioning.
> This problem only occurs when using the "X-Forwarded-Proto" header
>
> Using Wicket 7.6.0
> Any suggestions?
>
> Thanks!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message