> -----Original Message----- > From: Pedro [mailto:pstavs@xxxxxxxxx] > Sent: Monday, November 12, 2007 9:06 AM > To: users@xxxxxxxxxxxxxxxx > Subject: Re: Server redirects not working as expected > > Hi Owen, > > Thanks for your response. I thought Tomcat would redirect using the > request header, which contains the correct host name. So I > think I could > probably use it then? The cocoon Request object contains a number of methods that might return what you're looking for. Check out http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/Reque st.html and look at getServerName, getRequestURI etc. YOu might need to edit these a little to get what you want... Rgds, Owen Boyle Disclaimer: Any disclaimer attached to this message may be ignored. BTW - this is getting a bit OT wrt Apache (before someone complains... ;-) > > Peter > > Boyle Owen wrote: > >> -----Original Message----- > >> From: Pedro [mailto:pstavs@xxxxxxxxx] > >> Sent: Monday, November 12, 2007 7:49 AM > >> To: users@xxxxxxxxxxxxxxxx > >> Subject: Server redirects not working as expected > >> > >> Hi all, > >> > >> My Configuration consists of an Apache 2.0 front-end and > >> Tomcat 5.5.20 > >> backend, I use mod_proxy with mod_rewrite to reverse > proxy. We have > >> configured 'sticky sessions' using a rewrite rule, this > >> configuration is > >> soon to be replaced though with Apache 2.2 and the > mod_proxy_balancer. > >> > >> > >> The problem we are having is with redirects, for example > after a form > >> posts and an explicit redirect is invoked, such as > sendRedirect(URL) > >> (from HttpServletResponse), the URL returned points to the backend > >> Tomcat server instead of the front-end Apache server, > despite the URL > >> being a relative path. In other words: redirect to > >> MyApp/HomePage.html > >> should be : https://ApacheFrontEnd/myApp/HomePage.html but instead > >> returns: http://TomcatBackEnd:8080/MyApp/HomePage.html > >> > > > > I'm not surprised by this; the Tomcat server doesn't know there's an > > apache server in front of it so sends the redirect relative > to itself. > > This URL is therefore in the "Location" header of a 301 that apache > > simply forwards to the client. > > > > To get this to work, you have to work out the fully-qualified domain > > name (ie, http://external-servername/) of the apache server on the > > Tomcat side and prefix this to the URL. Something like; > > > > sendRedirect(methodToGetExternalDomainName() + relativeURL); > > > > Rgds, > > Owen Boyle > > Disclaimer: Any disclaimer attached to this message may be ignored. > > > > > >> I have tested the cookie and it is set correctly, as too is > >> the JVMRoute > >> parameter in Tomcat. This occurs notably only with server > >> redirects... > >> all other links work okay. > >> > >> Any pointers would be appreciated. > >> > >> Thanks > >> Peter > >> > >> > --------------------------------------------------------------------- > >> The official User-To-User support forum of the Apache HTTP > >> Server Project. > >> See <URL:http://httpd.apache.org/userslist.html> for more info. > >> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > >> " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx > >> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > >> > >> > > > > > > This message is for the named person's use only. It may > contain confidential, proprietary or legally privileged > information. No confidentiality or privilege is waived or > lost by any mistransmission. If you receive this message in > error, please notify the sender urgently and then immediately > delete the message and any copies of it from your system. > Please also immediately destroy any hardcopies of the > message. You must not, directly or indirectly, use, disclose, > distribute, print, or copy any part of this message if you > are not the intended recipient. The sender's company reserves > the right to monitor all e-mail communications through their > networks. Any views expressed in this message are those of > the individual sender, except where the message states > otherwise and the sender is authorised to state them to be > the views of the sender's company. > > > > > --------------------------------------------------------------------- > > The official User-To-User support forum of the Apache HTTP > Server Project. > > See <URL:http://httpd.apache.org/userslist.html> for more info. > > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > > " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx > > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > > > > > > > > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP > Server Project. > See <URL:http://httpd.apache.org/userslist.html> for more info. > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx