I have a wicket application which can be deployed in different environments. One of this environments is a server (lets call it S) behind a https proxy (lets call it P) so the pages on the application are accessed as
https://P:443/path/mountedPackage/Page?params=values
Everything worked fine in wicket 1.4 but with the migration to wicket 1.5, the request URL is changed to
http://P:443/path/mountedPackage/Page?params=values
(https is replaced by http) which leads to a “400 Bad Request” error. I don’t know why this happens but it brokes my external links to the application.
NOTE: I had this same problem before when submitting a form and calling the method setResponsePage(Page.class) and I solved it by setting a different RequestTarget and manually adding “https” instead of “http” when corresponds:
on wicket 1.4
component.getRequestCycle().setRequestTarget
(new RedirectRequestTarget("newURLWithPropperHttps"));
and on wicket 1.5
component.getRequestCycle().scheduleRequestHandlerAfterCurrent(new
RedirectRequestHandler("newURLWithPropperHttps"));
but now I am not calling any setResponsePage() or similar it happens when following a normal link from outside.
Any help? It is ok to use same solution as shown, but I don’t know where to implement it (I have tried on method get() of the IRequestCycleProvider but that leads me to anohter error)
I fixed the problem by writting my own
IRequestMapperwhich acts like the default one but on methodmapHandler()sets the protocol to https if it has to.