You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by FarhanS <fa...@gmail.com> on 2012/04/22 03:18:54 UTC

Wicket generates absolute urls for redirects 301? - Whats the way out

Hi Guys,

We are deploying our application in a new environment/infrastructure, where
it would sit behind a load-balancer and the
application/apache-server/virtual-host setup has changed a little, and is
causing problems in redirect scenarios, for which I want some help.

So here is the problem.

The virtual host definition (in virtual_host.conf in apache) against each of
the website hosted is now configured to listen on a non-default port (e.g. 
8081, 8082, 8083 etc). With that wherever Wicket pages has some redirection
logic built into it, e.g. using RedirectResponseException or
setResponsePage(Page.class), or any other means which involves redirection
(301/302), it is now injecting the port in the url e.g.
http://mydomainname:8081/request/uri. I was of the understanding that Wicket
always uses relative urls, even for redirect, as also implied in this ticket
(https://issues.apache.org/jira/browse/WICKET-2728) but apparently that is
not the case. Let me add that none of these redirect scenarios where this
problem is happening, we are not constructing/providing the url to forward
to, and in fact are using the framework api(s) (as above) itself to redirect
to different pages within the same application.

Can please someone guide me there as to how to fix this issue. Similarly
given the SSL enforcement is now taking place at the load-balancer level
(and not at the apache layer), the absolute url which is constructed is also
using http:// instead of https://, given the traffic within the network is
over http. All these problems are coming into play due to the
usage/construction of absolute urls.

Please guide..using 1.4.18 version.

Thanks in advance,

Farhan.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-generates-absolute-urls-for-redirects-301-Whats-the-way-out-tp4577479p4577479.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket generates absolute urls for redirects 301? - Whats the way out

Posted by David Rain <da...@kb.cz>.
Sending absolute URL in Location header is the only correct way according to
RFC.
Wicket passes relative URL to HttpServletResponse#sendRedirect method, but
J2EE web containers are obligated to convert this to absolute URL following
some rules.
See:
http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpServletResponse.html#sendRedirect
Sendind relative URLs via Location header would be violation of RFC. You can
realize this by implementing your own WebResponse and setting this header by
addHeader/setHeader (avoiding sendRedirect). Most browsers can handle it.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-generates-absolute-urls-for-redirects-301-Whats-the-way-out-tp4577479p4580060.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org