Re: Possible to send 503 status over JK?
I'm not sure why it works that way. I guess the idea is that if Tomcat has generated an error page, Apache shouldn't mess with it. When Tomcat is down the situation is different - the error comes from Apache (mod_jk), not Tomcat, so Apache is reponsible for the status code and error page. -- Len On 7/26/06, Rick G [EMAIL PROTECTED] wrote: Hi Len, On your comments, I totally understand that you can't override the tomcat 503 error page in a standalone Tomcat set up, especially from a webapp that isn't running. However, can you explain ... As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. I don't understand why Apache can't override it if it has the right status code, isn't that the whole point of having a status code handler in httpd.conf? Just seems that if Apache can handle the 503 with Tomcat down, that it shouldn't work any different with Tomcat running but with a webapp down, as long as if its returning the same status code. Thank you much for your feedback, Rick -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 6:26 PM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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] - 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: Possible to send 503 status over JK?
From what I see without some sort of firewall or BigIP interceptor The best solution is a Tomcat valve In this way Tomcat can detect *longer than unexpected* connect errors M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Len Popp [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, July 26, 2006 9:21 AM Subject: Re: Possible to send 503 status over JK? I'm not sure why it works that way. I guess the idea is that if Tomcat has generated an error page, Apache shouldn't mess with it. When Tomcat is down the situation is different - the error comes from Apache (mod_jk), not Tomcat, so Apache is reponsible for the status code and error page. -- Len On 7/26/06, Rick G [EMAIL PROTECTED] wrote: Hi Len, On your comments, I totally understand that you can't override the tomcat 503 error page in a standalone Tomcat set up, especially from a webapp that isn't running. However, can you explain ... As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. I don't understand why Apache can't override it if it has the right status code, isn't that the whole point of having a status code handler in httpd.conf? Just seems that if Apache can handle the 503 with Tomcat down, that it shouldn't work any different with Tomcat running but with a webapp down, as long as if its returning the same status code. Thank you much for your feedback, Rick -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 6:26 PM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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: Possible to send 503 status over JK?
I'll do some looking when I have a chance to see if I can figure out what is different between tomcats 503 and mod_jk's. Off the top of my head, the Tomcat 503 is returning content (the generated error page), where I'm guessing when tomcat is down and mod_jk returns the 503, there most likely is no content returned. Maybe I'll try recompiling tomcat to not generate the error page content just to see if the behavior changes. Thanks again for your input Len, -Rick -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Posted At: Wednesday, July 26, 2006 6:21 AM Subject: Re: Possible to send 503 status over JK? I'm not sure why it works that way. I guess the idea is that if Tomcat has generated an error page, Apache shouldn't mess with it. When Tomcat is down the situation is different - the error comes from Apache (mod_jk), not Tomcat, so Apache is reponsible for the status code and error page. -- Len On 7/26/06, Rick G [EMAIL PROTECTED] wrote: Hi Len, On your comments, I totally understand that you can't override the tomcat 503 error page in a standalone Tomcat set up, especially from a webapp that isn't running. However, can you explain ... As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. I don't understand why Apache can't override it if it has the right status code, isn't that the whole point of having a status code handler in httpd.conf? Just seems that if Apache can handle the 503 with Tomcat down, that it shouldn't work any different with Tomcat running but with a webapp down, as long as if its returning the same status code. Thank you much for your feedback, Rick -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 6:26 PM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: Possible to send 503 status over JK?
are the HTML error pages created dynamically? Are or they where they can be extracted (presumably out of a jar file) and then edited and the jar recompiled? I don't find the docs anywhere within my Tomcat version (4.1.3). -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 25, 2006 8:26 PM To: Tomcat Users List Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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: Possible to send 503 status over JK?
The default error page is hard-coded in org.apache.catalina.valves.ErrorReportValve.report() -- Len On 7/26/06, Propes, Barry L [EMAIL PROTECTED] wrote: are the HTML error pages created dynamically? Are or they where they can be extracted (presumably out of a jar file) and then edited and the jar recompiled? I don't find the docs anywhere within my Tomcat version (4.1.3). -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 25, 2006 8:26 PM To: Tomcat Users List Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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] - 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: Possible to send 503 status over JK?
ok, thanks. -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 26, 2006 10:48 AM To: Tomcat Users List Subject: Re: Possible to send 503 status over JK? The default error page is hard-coded in org.apache.catalina.valves.ErrorReportValve.report() -- Len On 7/26/06, Propes, Barry L [EMAIL PROTECTED] wrote: are the HTML error pages created dynamically? Are or they where they can be extracted (presumably out of a jar file) and then edited and the jar recompiled? I don't find the docs anywhere within my Tomcat version (4.1.3). -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 25, 2006 8:26 PM To: Tomcat Users List Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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] - 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: Possible to send 503 status over JK?
If you dont mind handling this programmatically..check out this Filter for 503 errors http://java.sun.com/developer/JDCTechTips/2001/tt0626.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org Sent: Tuesday, July 25, 2006 11:21 AM Subject: Possible to send 503 status over JK? Hi All, I saw a similar question asked a while back about using a custom 503 errorpage, but never saw an answer. I'm looking to, if a page is requested for a webapp that has been stopped, instead of returning the canned Tomcat 503 Error page, to have it return a 503 status code instead so that you can have Apache handle it and show a custom (pretty) error page. It seems like on a 503, Tomcat generates its own 503 page and returns status 200 so Apache doesn't know it needs to do something. Some one please correct me if I'm wrong and/or there is an easy solution to this. Otherwise, anyone familiar or have a link with the standard processing pipeline in tomcat 5.5.x and know the order of valve/filter execution that can point me in the right direction? Thanks for any help, Rick G - 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: Possible to send 503 status over JK?
Hi Martin, doesn't the example you listed involve the webapp actually running to return a 503 in a particular circumstance? I'm trying to handle a 503 when the webapp is actually stopped, by the manager app/JMX. So nothing code/config wise in the webapp would fix the problem that I can think of, it would have to be a code/config change for tomcat itself. This is why I was looking for the default request handling pipeline order. In my initial browsing of the code... org.apache.ajp.RequstHandler::decodeRequest(Ajp13 ch, Ajp13Packet msg, BaseRequest req) int The comments for the return value say... @return 200 in case of a successful decoduing, 500 in case of error. But I'm still reading Again if anyone has any info that can point me in the right direction, I would appreciate it. -Rick -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 9:01 AM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? If you dont mind handling this programmatically..check out this Filter for 503 errors http://java.sun.com/developer/JDCTechTips/2001/tt0626.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org Sent: Tuesday, July 25, 2006 11:21 AM Subject: Possible to send 503 status over JK? Hi All, I saw a similar question asked a while back about using a custom 503 errorpage, but never saw an answer. I'm looking to, if a page is requested for a webapp that has been stopped, instead of returning the canned Tomcat 503 Error page, to have it return a 503 status code instead so that you can have Apache handle it and show a custom (pretty) error page. It seems like on a 503, Tomcat generates its own 503 page and returns status 200 so Apache doesn't know it needs to do something. Some one please correct me if I'm wrong and/or there is an easy solution to this. Otherwise, anyone familiar or have a link with the standard processing pipeline in tomcat 5.5.x and know the order of valve/filter execution that can point me in the right direction? Thanks for any help, Rick G - 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: Possible to send 503 status over JK?
Martin, As for proxy servers, no I have not looked into that. But I don't think I would want to add another layer to the mix just to have to parse all requests for the off chance that the webapp is stopped. Especially when Tomcat knows that the webapp is unavailable, there should be a simple option to set if Tomcat generates its own status pages or returns the proper http status code so that said errors can be handled by apache instead. It does already properly return on a 500 application error. Tomcat gives you its on 503 error page if the webapp is down, so it shouldn't be that big of a stretch to have it just return a 503 status code so that apache can catch it. Again, I may be missing something, but I'm reading through the code now to see if I can get it to return the 503 status code when applicable. It seems to me like this would be the correct behavior, at least when using a front end web server. -Rick -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 10:30 AM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? Rick- Have you looked at proxy servers? http://www.experts-exchange.com/Networking/Q_21679699.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org; 'Martin Gainty' [EMAIL PROTECTED] Sent: Tuesday, July 25, 2006 12:37 PM Subject: RE: Possible to send 503 status over JK? Hi Martin, doesn't the example you listed involve the webapp actually running to return a 503 in a particular circumstance? I'm trying to handle a 503 when the webapp is actually stopped, by the manager app/JMX. So nothing code/config wise in the webapp would fix the problem that I can think of, it would have to be a code/config change for tomcat itself. This is why I was looking for the default request handling pipeline order. In my initial browsing of the code... org.apache.ajp.RequstHandler::decodeRequest(Ajp13 ch, Ajp13Packet msg, BaseRequest req) int The comments for the return value say... @return 200 in case of a successful decoduing, 500 in case of error. But I'm still reading Again if anyone has any info that can point me in the right direction, I would appreciate it. -Rick -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 9:01 AM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? If you dont mind handling this programmatically..check out this Filter for 503 errors http://java.sun.com/developer/JDCTechTips/2001/tt0626.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org Sent: Tuesday, July 25, 2006 11:21 AM Subject: Possible to send 503 status over JK? Hi All, I saw a similar question asked a while back about using a custom 503 errorpage, but never saw an answer. I'm looking to, if a page is requested for a webapp that has been stopped, instead of returning the canned Tomcat 503 Error page, to have it return a 503 status code instead so that you can have Apache handle it and show a custom (pretty) error page. It seems like on a 503, Tomcat generates its own 503 page and returns status 200 so Apache doesn't know it needs to do something. Some one please correct me if I'm wrong and/or there is an easy solution to this. Otherwise, anyone familiar or have a link with the standard processing pipeline in tomcat 5.5.x and know the order of valve/filter execution that can point me in the right direction? Thanks for any help, Rick G - 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
Re: Possible to send 503 status over JK?
The only viable solution is to setup a filter and monitor invocations of init(), doFilter and destroy() method where the timeout could be calc'ed as getCurrentTime() - lastgetCurrentTime() ElapsedTimeParameterFromFilterConfig.getInitParameter(Timeout) check out http://tomcat.apache.org/tomcat-5.0-doc/servletapi/javax/servlet/Filter.html for details.. Anyone else ??? M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org Sent: Tuesday, July 25, 2006 1:54 PM Subject: RE: Possible to send 503 status over JK? Martin, As for proxy servers, no I have not looked into that. But I don't think I would want to add another layer to the mix just to have to parse all requests for the off chance that the webapp is stopped. Especially when Tomcat knows that the webapp is unavailable, there should be a simple option to set if Tomcat generates its own status pages or returns the proper http status code so that said errors can be handled by apache instead. It does already properly return on a 500 application error. Tomcat gives you its on 503 error page if the webapp is down, so it shouldn't be that big of a stretch to have it just return a 503 status code so that apache can catch it. Again, I may be missing something, but I'm reading through the code now to see if I can get it to return the 503 status code when applicable. It seems to me like this would be the correct behavior, at least when using a front end web server. -Rick -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 10:30 AM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? Rick- Have you looked at proxy servers? http://www.experts-exchange.com/Networking/Q_21679699.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org; 'Martin Gainty' [EMAIL PROTECTED] Sent: Tuesday, July 25, 2006 12:37 PM Subject: RE: Possible to send 503 status over JK? Hi Martin, doesn't the example you listed involve the webapp actually running to return a 503 in a particular circumstance? I'm trying to handle a 503 when the webapp is actually stopped, by the manager app/JMX. So nothing code/config wise in the webapp would fix the problem that I can think of, it would have to be a code/config change for tomcat itself. This is why I was looking for the default request handling pipeline order. In my initial browsing of the code... org.apache.ajp.RequstHandler::decodeRequest(Ajp13 ch, Ajp13Packet msg, BaseRequest req) int The comments for the return value say... @return 200 in case of a successful decoduing, 500 in case of error. But I'm still reading Again if anyone has any info that can point me in the right direction, I would appreciate it. -Rick -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 9:01 AM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? If you dont mind handling this programmatically..check out this Filter for 503 errors http://java.sun.com/developer/JDCTechTips/2001/tt0626.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Rick G [EMAIL PROTECTED] To: 'Tomcat Users List' users@tomcat.apache.org Sent: Tuesday, July 25, 2006 11:21 AM Subject: Possible to send 503 status over JK? Hi All, I saw a similar question asked a while back about using a custom 503 errorpage, but never saw an answer. I'm looking to, if a page is requested for a webapp that has been stopped
Re: Possible to send 503 status over JK?
On 7/25/06, Rick G [EMAIL PROTECTED] wrote: It seems like on a 503, Tomcat generates its own 503 page and returns status 200 What makes you think this? I just stopped a webapp with the manager, tried to load a page, and got (using LiveHttpHeaders) the Tomcat 503 page with the expected status 503 header. So there wouldn't seem to be a problem, eh? -- Hassan Schroeder [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: Possible to send 503 status over JK?
My reasoning was that Apache doesn't catch the 503, but it does catch a 500.. /etc/httpd/conf/httpd.conf ... ErrorDocument 500 /notice.html ErrorDocument 503 /notice.html ... The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? What version of apache? What connector? (jk/jk2/jk_proxy) Thanks for your input, -Rick -Original Message- From: Hassan Schroeder [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 3:55 PM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? On 7/25/06, Rick G [EMAIL PROTECTED] wrote: It seems like on a 503, Tomcat generates its own 503 page and returns status 200 What makes you think this? I just stopped a webapp with the manager, tried to load a page, and got (using LiveHttpHeaders) the Tomcat 503 page with the expected status 503 header. So there wouldn't seem to be a problem, eh? -- Hassan Schroeder [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] - 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: Possible to send 503 status over JK?
On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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: Possible to send 503 status over JK?
The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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: Possible to send 503 status over JK?
Hi Len, On your comments, I totally understand that you can't override the tomcat 503 error page in a standalone Tomcat set up, especially from a webapp that isn't running. However, can you explain ... As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. I don't understand why Apache can't override it if it has the right status code, isn't that the whole point of having a status code handler in httpd.conf? Just seems that if Apache can handle the 503 with Tomcat down, that it shouldn't work any different with Tomcat running but with a webapp down, as long as if its returning the same status code. Thank you much for your feedback, Rick -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Posted At: Tuesday, July 25, 2006 6:26 PM Posted To: Tomcat Dev Conversation: Possible to send 503 status over JK? Subject: Re: Possible to send 503 status over JK? The recent messages on this topic have confused me, so I've spent part of my evening running some tests. = First, with Tomcat standalone: Tomcat's default error pages can be overridden by an error-page declaration in the webapp's web.xml. If there is no error-page declared, Tomcat uses its default error page; it does *not* fall back to a global error page declared in the ROOT webapp. When a webapp is stopped, its error pages are not executed (obviously), so Tomcat's default error pages are used. Therefore it is not possible to override the 503 page when the webapp is stopped. Tomcat always uses its default page. In any case, the correct HTTP status code is returned to the browser. = With Tomcat behind Apache and mod_jk: As long as Tomcat is running, the situation is the same as above. JK and Apache pass Tomcat's error pages and status codes back unchanged. ErrorDocument declarations do not override Tomcat's error pages. When Tomcat is down (not just one webapp stopped, but Tomcat not running at all), you obviously don't get a Tomcat error page. Apache generates the 503 error and uses its own error page. This page can be overridden by ErrorDocument. Again, the correct HTTP status codes are returned to the browser. So, you can use a custom ErrorDocument to return a Site Down message if Tomcat is down completely, but not if a webapp inside Tomcat is stopped. These tests were done with Tomcat 5.5.17, Apache 2.0.55, JK 1.2.15. -- Len On 7/25/06, Hassan Schroeder [EMAIL PROTECTED] wrote: On 7/25/06, Rick G [EMAIL PROTECTED] wrote: The 500 is caught correctly, but I always end up seeing the tomcat generated error page for a 503. I guess this could be a mod_jk or apache issue if you are saying that tomcat is sending the right status code. Questions: what version of tomcat you running? that quick test was on 5.5.17 standalone just to confirm the correct http header was being sent. -- Hassan Schroeder [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] - 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]