https://issues.apache.org/bugzilla/show_bug.cgi?id=50734
Summary: 400 Bad Request when there are no web applications deployed on Tomcat 6.0.32 Product: Tomcat 6 Version: 6.0.32 Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: violet...@apache.org Hi, I have the following use case: I have no web applications deployed on Tomcat. Nevertheless when I request a web application: http://localhost:8080/testapp Instead of the expected 404 Not Found I'm receiving 400 Bad Request. This scenario is tested on 6.0.32 and 7.0.8, it is working as expected on 7.0.8. While searching the code for both versions, I can see that in 7.0.8 you have the following: org.apache.catalina.connector.CoyoteAdapter.postParseRequest(Request, Request, Response, Response) ... // If there is no context at this point, it is likely no ROOT context // has been deployed if (request.getContext() == null) { res.setStatus(404); res.setMessage("Not found"); // No context, so use host request.getHost().logAccess(request, response, 0, true); return false; } ... In the 6.0.32 version of the same class there is no such statement. When entering org.apache.catalina.core.StandardEngineValve.invoke(Request, Response) ... if (host == null) { response.sendError (HttpServletResponse.SC_BAD_REQUEST, sm.getString("standardEngine.noHost", request.getServerName())); return; } ... the host is null because the context is null. So 400 Bad Request is returned. Could you please introduce the check from Tomcat 7.0.8 in Tomcat 6.0.x. I think that 404 Not Found is more appropriate for this use case and not 400 Bad Request. The 400 status code typically is returned in case the request cannot be fulfilled due to bad syntax. Thanks in advance Best Regards Violeta Georgieva -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- 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