[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 --- Comment #7 from Konstantin Kolinko --- Some notes from me: 1. If a web application has been stopped (or failed to start), its mappings are absent from the org.apache.catalina.mapper.Mapper. That is the key point here. Period. 2. Falling back to the ROOT application is "well known". E.g. it was used in Tomcat 5.5: https://svn.apache.org/viewvc/tomcat/archive/tc5.5.x/trunk/container/webapps/ROOT/ It is a ROOT web application and it has an "admin" subdirectory. It is used for the case when the "admin" web application has not been installed. 3. Nowadays it is also possible to use the "Parallel deployment" feature to install several versions of a web application in parallel. https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Parallel_deployment This works with the ROOT application itself as well. E.g. if "ROOT" is the fallback webapp, and your "productive" webapp is named "ROOT##2024-05-23" and fails to start, a request should be served by the "ROOT" one. Quote, from config/context.html: "String comparisons are used to determine version order. If version is not specified, it is treated as the empty string. Therefore, foo.war will be treated as an earlier version than foo##11.war" -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 --- Comment #6 from Mark Thomas --- (In reply to Michael Osipov from comment #5) > (In reply to Mark Thomas from comment #4) > > How to respond when a web application is stopped is very much personal > > preference. Some administrators will want 404, some 403, some something > > else. > > > > Handing this is in the Mapper is non-trivial. > > Can you explain why it is non-trivial if you have an attribute for this in > ? Try writing a patch to implement it. > > Given that this can be handled by the ROOT web application as Chris > > describes, I'm resolving this as WONTFIX. > > That would work, but looks overly complicated and not really dynamic. I > highly doubt that people would prefer to go that route. Then we disagree. I consider it a simple solution and I've seen it used in production. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 --- Comment #5 from Michael Osipov --- (In reply to Mark Thomas from comment #4) > How to respond when a web application is stopped is very much personal > preference. Some administrators will want 404, some 403, some something else. > > Handing this is in the Mapper is non-trivial. Can you explain why it is non-trivial if you have an attribute for this in ? > Given that this can be handled by the ROOT web application as Chris > describes, I'm resolving this as WONTFIX. That would work, but looks overly complicated and not really dynamic. I highly doubt that people would prefer to go that route. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #4 from Mark Thomas --- How to respond when a web application is stopped is very much personal preference. Some administrators will want 404, some 403, some something else. Handing this is in the Mapper is non-trivial. Given that this can be handled by the ROOT web application as Chris describes, I'm resolving this as WONTFIX. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 --- Comment #3 from Christopher Schultz --- (In reply to Michael Osipov from comment #2) > I am not convinced by either approach because in any case it would require me > to deploy a ROOT application with Tomcat privileges to properly fetch the > URL and check whether the application is truly stopped. I don't think so. If Tomcat cannot route a request to a non-ROOT application, the ROOT application will receive the request instead. So, for example, if you expect a resource to be available at /myapp/resource but the /myapp application is not running for whatever reason, then /myapp/resource will be served by the ROOT application. There is no reason for the ROOT application to then turn-around and re-request /myapp/resource from Tomcat "to see if it's working". You already know its NOT working since it was routed to ROOT. > > Tomcat rewrite Valve > This is static, I should dynamically be able to determine that the requested > webapp is down See above. I think Tomcat provides that without you having to probe anything. > > plain JSP + configuration in web.xml > How? The status is issued by the container, how am I supposed to change the > status code reasonably from a JSP. Looks wrong to me. If /myapp/resource is not available, it will be served by ROOT. Here is where you get to pick the HTTP status code. Tomcat will not say "oh and by the way, /myapp/resource was supposed to be served by /myapp but I had to give it to you, instead so something is definitely wrong". Instead, the simple fact that ROOT is handling the request means that /myapp is not running so ROOT "knows" something is wrong already. Just return a 503 or 404 or 123 from whatever mechanism you want. > > Custom Java code that you write > Too sophisticated honestly. > > I think that it is best configured at or level inside of > Tomcat. I'm suggesting this is already possible: just configure a ROOT context inside a and you are done. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 --- Comment #2 from Michael Osipov --- Chris, I am not convined by either approach because in any case it would require me to deploy a ROOT application with Tomcat priviledges to properly fetch the URL and check whether the application is truly stopped. > Tomcat rewrite Valve This is static, I should dynamically be able to determine that the requested webapp is down > plain JSP + configuration in web.xml How? The status is issued by the container, how am I supposed to change the status code reasonably from a JSP. Looks wrong to me. > Custom Java code that you write Too sophisticated honestly. I think that it is best configured at or level inside of Tomcat. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 --- Comment #1 from Christopher Schultz --- This can be easily done using the ROOT web application with a custom response for e.g. /myapp/* which will execute when /myapp/ hasn't deployed properly. You can even use the status code of your choosing. Your choice of implementation can include: - Tomcat rewrite Valve - plain JSP + configuration in web.xml - Custom Java code that you write I don't think this needs to have further support than is already available, do you? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68919] Make Tomcat return 503 on stopped web applications
https://bz.apache.org/bugzilla/show_bug.cgi?id=68919 Michael Osipov changed: What|Removed |Added CC||micha...@apache.org -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org