Re: need help with Tomcat-generated redirects
On Wed, Jan 2, 2008 at 9:10 PM, Bill Barker [EMAIL PROTECTED] wrote: Rainer Jung [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Julian, Julian Dunn schrieb: How do you connect Apache to Tomcat? If you are using mod_jk, the module gets the port it sends to Tomcat via ap_get_server_port(), which in turn depends on UseCanonicalName. If this is set to On, the port is also determined from the port in ServerName. I'm using mod_jk 1.2.6 and Apache 2.0.59. UseCanonicalName is already on in the Apache server, and the ServerName is set to www.site.com:80 in the VirtualHost. I also tried to set ServerName globally and that didn't make a difference. This allows mod_rewrite to send the correct port # in rewrites, but Tomcat doesn't seem to pick this up for some reason. By the way, don't laugh, but this is a legacy Tomcat 3.3.1a application so I need something for that version of Tomcat. I'm not laughing (at least I try to). Since I'm relatively sure about the jk feature: what about updating to a recent jk version. 1.2.6 is ..., we are at 1.2.26. Assuming that you are using the AJP13Interceptor, then updating the mod_jk version should be enough. The problem is that mod_jk 1.2.6 doesn't respect the UseCanonicalName directive and sends the actual port that Apache is listening on. If you are using the CoyoteConnector (which was released as an addon to 3.3.1a), then I think that the proxyPort directive will work. This connector also ships with 3.3.2, which is a fairly painless upgrade (as opposed to 5.5.x or 6.0.x). Ok, thanks for your advice, Bill - I'll see what we can do about building a more recent mod_jk to prop this environment up for now. We are using AJP/1.3 so I think that should be fairly safe. - Julian - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
need help with Tomcat-generated redirects
Hi, I have some applications running under a Tomcat installation set up in this way: [load balancer on port 80] --- [Apache server on port 5001] -- [Tomcat server on port 7001] One of the Tomcat applications sends a redirect to Apache because there is a welcome-file directive. However, the redirect that is sent says: www.site.com:5001/foo/bar.jsp instead of www.site.com/foo/bar.jsp On the Apache side, I already have ServerName set to www.site.com:80 to solve this problem for mod_rewrite. What is the corresponding directive for Tomcat? - Julian -- -- Julian C. Dunn, P.Eng. [EMAIL PROTECTED] -- Assistant Team Lead, Media Production Support, CBC Technology -- Digital Programming and Business Development -- Office: 2C310-N * Tel.: (416) 205-3311 x6988 * DID: 1-151-6988 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help with Tomcat-generated redirects
Connector attribute proxyPort should fix the inclusion of the port number in tomcat generated urls. --David Julian Dunn wrote: Hi, I have some applications running under a Tomcat installation set up in this way: [load balancer on port 80] --- [Apache server on port 5001] -- [Tomcat server on port 7001] One of the Tomcat applications sends a redirect to Apache because there is a welcome-file directive. However, the redirect that is sent says: www.site.com:5001/foo/bar.jsp instead of www.site.com/foo/bar.jsp On the Apache side, I already have ServerName set to www.site.com:80 to solve this problem for mod_rewrite. What is the corresponding directive for Tomcat? - Julian -- -- Julian C. Dunn, P.Eng. [EMAIL PROTECTED] -- Assistant Team Lead, Media Production Support, CBC Technology -- Digital Programming and Business Development -- Office: 2C310-N * Tel.: (416) 205-3311 x6988 * DID: 1-151-6988 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help with Tomcat-generated redirects
Hi Julian, Julian Dunn schrieb: Hi, I have some applications running under a Tomcat installation set up in this way: [load balancer on port 80] --- [Apache server on port 5001] -- [Tomcat server on port 7001] One of the Tomcat applications sends a redirect to Apache because there is a welcome-file directive. However, the redirect that is sent says: www.site.com:5001/foo/bar.jsp instead of www.site.com/foo/bar.jsp On the Apache side, I already have ServerName set to www.site.com:80 to solve this problem for mod_rewrite. What is the corresponding directive for Tomcat? How do you connect Apache to Tomcat? If you are using mod_jk, the module gets the port it sends to Tomcat via ap_get_server_port(), which in turn depends on UseCanonicalName. If this is set to On, the port is also determined from the port in ServerName. The AJP protocol then makes sure, that Tomcat thinks it's using the port that mod_jk told Tomcat. In case this doesn't work or you are using some other way to connect Apache to Tomcat: The connector element in server.xml knows about attributes proxyName, proxyPort and scheme. See http://tomcat.apache.org/tomcat-6.0-doc/config/http.html - Julian Regards, Rainer - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help with Tomcat-generated redirects
On Wed, Jan 2, 2008 at 4:48 PM, Rainer Jung [EMAIL PROTECTED] wrote: I have some applications running under a Tomcat installation set up in this way: [load balancer on port 80] --- [Apache server on port 5001] -- [Tomcat server on port 7001] One of the Tomcat applications sends a redirect to Apache because there is a welcome-file directive. However, the redirect that is sent says: www.site.com:5001/foo/bar.jsp instead of www.site.com/foo/bar.jsp On the Apache side, I already have ServerName set to www.site.com:80 to solve this problem for mod_rewrite. What is the corresponding directive for Tomcat? How do you connect Apache to Tomcat? If you are using mod_jk, the module gets the port it sends to Tomcat via ap_get_server_port(), which in turn depends on UseCanonicalName. If this is set to On, the port is also determined from the port in ServerName. I'm using mod_jk 1.2.6 and Apache 2.0.59. UseCanonicalName is already on in the Apache server, and the ServerName is set to www.site.com:80 in the VirtualHost. I also tried to set ServerName globally and that didn't make a difference. This allows mod_rewrite to send the correct port # in rewrites, but Tomcat doesn't seem to pick this up for some reason. By the way, don't laugh, but this is a legacy Tomcat 3.3.1a application so I need something for that version of Tomcat. - Julian - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help with Tomcat-generated redirects
Hi Julian, Julian Dunn schrieb: How do you connect Apache to Tomcat? If you are using mod_jk, the module gets the port it sends to Tomcat via ap_get_server_port(), which in turn depends on UseCanonicalName. If this is set to On, the port is also determined from the port in ServerName. I'm using mod_jk 1.2.6 and Apache 2.0.59. UseCanonicalName is already on in the Apache server, and the ServerName is set to www.site.com:80 in the VirtualHost. I also tried to set ServerName globally and that didn't make a difference. This allows mod_rewrite to send the correct port # in rewrites, but Tomcat doesn't seem to pick this up for some reason. By the way, don't laugh, but this is a legacy Tomcat 3.3.1a application so I need something for that version of Tomcat. I'm not laughing (at least I try to). Since I'm relatively sure about the jk feature: what about updating to a recent jk version. 1.2.6 is ..., we are at 1.2.26. I never worked with TC 3.3, but the docs tell us, that it allows an AJP13 connector, so that one should be compatible with recent JK versions. In case you are still using AJP12, that's not a safe bet to use AJP12 with recent JK. The docs look like the connector attributes we posted as an alternative solution unfortunately don't exist for 3.3. - Julian Regards, Rainer - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help with Tomcat-generated redirects
Rainer Jung [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Julian, Julian Dunn schrieb: How do you connect Apache to Tomcat? If you are using mod_jk, the module gets the port it sends to Tomcat via ap_get_server_port(), which in turn depends on UseCanonicalName. If this is set to On, the port is also determined from the port in ServerName. I'm using mod_jk 1.2.6 and Apache 2.0.59. UseCanonicalName is already on in the Apache server, and the ServerName is set to www.site.com:80 in the VirtualHost. I also tried to set ServerName globally and that didn't make a difference. This allows mod_rewrite to send the correct port # in rewrites, but Tomcat doesn't seem to pick this up for some reason. By the way, don't laugh, but this is a legacy Tomcat 3.3.1a application so I need something for that version of Tomcat. I'm not laughing (at least I try to). Since I'm relatively sure about the jk feature: what about updating to a recent jk version. 1.2.6 is ..., we are at 1.2.26. Assuming that you are using the AJP13Interceptor, then updating the mod_jk version should be enough. The problem is that mod_jk 1.2.6 doesn't respect the UseCanonicalName directive and sends the actual port that Apache is listening on. If you are using the CoyoteConnector (which was released as an addon to 3.3.1a), then I think that the proxyPort directive will work. This connector also ships with 3.3.2, which is a fairly painless upgrade (as opposed to 5.5.x or 6.0.x). I never worked with TC 3.3, but the docs tell us, that it allows an AJP13 connector, so that one should be compatible with recent JK versions. In case you are still using AJP12, that's not a safe bet to use AJP12 with recent JK. Yes, the AJP/1.2 connector was deprecated even for 3.3.1a (except as a way to shut Tomcat down :).To get this to work, you'll have to be using the AJP/1.3 protocol. The docs look like the connector attributes we posted as an alternative solution unfortunately don't exist for 3.3. - Julian Regards, Rainer - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat and Redirects
Good point regarding the compatibility kit, that completely slipped my mind :). Thanks, Tony -Original Message- From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 2:05 PM To: Tomcat Users List Subject: RE: Tomcat and Redirects From: Tony Fountain [mailto:[EMAIL PROTECTED] Subject: RE: Tomcat and Redirects Just to clarify, you can run Java programs compiled in 1.4, but the JVM installed on the machine running the app should be 1.5 or greater. That's not true either. All you need to run Tomcat 5.5 on a 1.4 JVM is the small compatibility kit available on the Tomcat download page. Tomcat 5.5 works perfectly well on JRE 1.4. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This Email has been scanned for all viruses by PAETEC Email Scanning Services, utilizing MessageLabs proprietary SkyScan infrastructure. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.paetec.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat and Redirects
Hi Chris, This is exactly the answer I was looking for. Thank you for your help. Cheers, Danny On Sun, 2007-11-11 at 10:51 -0500, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bill, Bill Barker wrote: Tomcat always sends a 302 redirect when response.sendRedirect(newURL); is called. However, a lot of user-agents wrongly follow the redirect with a GET when the initial request was a POST. Actually, this behavior is basically grandfathered-into the HTTP specification. See section 10.3.3 of the HTTP/1.1 spec: If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. Note: RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client. Since the servlet specification does not say which redirection code should be used with response.sendRedirect (though it is pretty much always implemented as a 302), you will have to use response.setHeader and response.sendError with the code you prefer. I'm pretty sure you want to use either 303 or 307 and not 302 due to its inconsistent implementation. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHNyTx9CaO5/Lv0PARAgb6AKCI3eiqPBM2IQ8+XfUwxH4yNGT85QCeIGF2 G1vMEtBhAU+nJVClTOPU9JQ= =7PAC -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat and Redirects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bill, Bill Barker wrote: Tomcat always sends a 302 redirect when response.sendRedirect(newURL); is called. However, a lot of user-agents wrongly follow the redirect with a GET when the initial request was a POST. Actually, this behavior is basically grandfathered-into the HTTP specification. See section 10.3.3 of the HTTP/1.1 spec: If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. Note: RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client. Since the servlet specification does not say which redirection code should be used with response.sendRedirect (though it is pretty much always implemented as a 302), you will have to use response.setHeader and response.sendError with the code you prefer. I'm pretty sure you want to use either 303 or 307 and not 302 due to its inconsistent implementation. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHNyTx9CaO5/Lv0PARAgb6AKCI3eiqPBM2IQ8+XfUwxH4yNGT85QCeIGF2 G1vMEtBhAU+nJVClTOPU9JQ= =7PAC -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat and Redirects
Hi All, I have a question about how Tomcat handles redirects. We have a vendor who wrote an application for us and they tell us that they always use the same method of issuing redirects in their code. What we have seen is on certain requests from a WAP handset the application will issue a redirect and Tomcat will issue it as an HTTP 302 redirect. On other handsets for some reason these same redirects are issued as an HTTP 200 with an embedded link that the user has to click on to redirect. We believe this may be to the POST headers that the handset is sending but haven't managed to narrow it down to which. We would like all of these redirects to be done with the automatic 302 redirect. Is there any way to force these redirects to be done with the HTTP 302? We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp Cheers, Danny - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat and Redirects
the quick answer is to handle the response-code in web.xml e.g. error-page error-code302/error-code location/axis2-web/Error/error302.jsp/location /error-page M-- - Original Message - From: Dwebb [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Friday, November 09, 2007 11:35 AM Subject: Tomcat and Redirects Hi All, I have a question about how Tomcat handles redirects. We have a vendor who wrote an application for us and they tell us that they always use the same method of issuing redirects in their code. What we have seen is on certain requests from a WAP handset the application will issue a redirect and Tomcat will issue it as an HTTP 302 redirect. On other handsets for some reason these same redirects are issued as an HTTP 200 with an embedded link that the user has to click on to redirect. We believe this may be to the POST headers that the handset is sending but haven't managed to narrow it down to which. We would like all of these redirects to be done with the automatic 302 redirect. Is there any way to force these redirects to be done with the HTTP 302? We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp Cheers, Danny - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat and Redirects
Dwebb wrote: We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp Hi Danny, you shouldn't run tomcat 5.5.x with JAva 1.4. It's designed to work with Java 5 and up. bye -- NO OOXML - Say NO To Microsoft Office broken standard http://www.noooxml.org - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat and Redirects
Just to clarify, you can run Java programs compiled in 1.4, but the JVM installed on the machine running the app should be 1.5 or greater. I'm doing that now with a commercial app we purchased (Apache Tomcat 5.5.23, JVM 1.5.0_12-b04 but the application itself is compiled under Java 1.4 and runs just fine. Thanks, Tony Fountain Manager, Database Administration Benefit Concepts, Inc. (419) 244-9936 x9010 (office) (419) 249-7221 (fax) -Original Message- From: Michael [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 1:45 PM To: Tomcat Users List Subject: Re: Tomcat and Redirects Dwebb wrote: We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp Hi Danny, you shouldn't run tomcat 5.5.x with JAva 1.4. It's designed to work with Java 5 and up. bye -- NO OOXML - Say NO To Microsoft Office broken standard http://www.noooxml.org - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This Email has been scanned for all viruses by PAETEC Email Scanning Services, utilizing MessageLabs proprietary SkyScan infrastructure. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.paetec.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat and Redirects
From: Tony Fountain [mailto:[EMAIL PROTECTED] Subject: RE: Tomcat and Redirects Just to clarify, you can run Java programs compiled in 1.4, but the JVM installed on the machine running the app should be 1.5 or greater. That's not true either. All you need to run Tomcat 5.5 on a 1.4 JVM is the small compatibility kit available on the Tomcat download page. Tomcat 5.5 works perfectly well on JRE 1.4. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat and Redirects
Dwebb [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi All, I have a question about how Tomcat handles redirects. We have a vendor who wrote an application for us and they tell us that they always use the same method of issuing redirects in their code. What we have seen is on certain requests from a WAP handset the application will issue a redirect and Tomcat will issue it as an HTTP 302 redirect. On other handsets for some reason these same redirects are issued as an HTTP 200 with an embedded link that the user has to click on to redirect. We believe this may be to the POST headers that the handset is sending but haven't managed to narrow it down to which. We would like all of these redirects to be done with the automatic 302 redirect. Tomcat always sends a 302 redirect when response.sendRedirect(newURL); is called. However, a lot of user-agents wrongly follow the redirect with a GET when the initial request was a POST. I'm guessing that your vendor has some special code that is attempting to work around this. Is there any way to force these redirects to be done with the HTTP 302? We are running Tomcat 5.5.11, Java 1.4.2_04-b05 on Linux 2.6.9-34.ELsmp Cheers, Danny - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Apache handling HTTPS forwards to Tomcat HTTP, Tomcat HTTP redirects to HTTPS, loop.
I found out the specific cause of my problem and now I am looking at solutions. The easiest is to take apache out of the equation and have tomcat handle the ssl. I am on a hosted shared server and I think the reason apache is handling the ssl is to take the computational load of encryption off of the shared server so I am pretty much stuck in my present situation. I think the solution that I can implement is modifying the HttpConnector to recoignise the difference b/t a request that has come through apache and been decrypted from a straight browser request to the http port. Has anyone made these modifications to the HttpConnector? or is there perhaps some built in functionality in the HttpConnector that might allow me to do this without have to extend or modify it? Thanks for any advice, MG - Original Message From: Mike Grandmaison [EMAIL PROTECTED] To: tomcat-u users@tomcat.apache.org Sent: Friday, March 2, 2007 2:25:50 PM Subject: Http Connector Redirect - Not working with Portforwarding on hosted solution Hi, I am trying to get the user-data-constraint transport-guaranteeCONFIDENTIAL/transport-guarantee /user-data-constraint to work. I have it working on my development machine. The problem is when I move the code over to the stagging server it does not work. My stagging server differs from my dev machine in that port forwarding is taking place. Specifically http and https ports for my virtual host are being forwarded to tomcat. Now what I would expect in this case is that all I would need to change would be the redirectPort attribute value of the Http Connector such that it forwards to 443 which the port forwarding would then forward to the tomcat specific https port. I have tried that but without success. Has anyone else had this problem and had any luck getting it to work under these conditions. Thank you for any advice, MG Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097