Resolve 404 when requesting a Tomcat app

Home > Search
  by

Http response code 404 means that the server is able to communicate with the client, but the resource being requested by the client cannot be located on the server. Before we get into how this is done on Tomcat, let's look at how this is done on a stand alone web server.

 


Stand Alone Web Server

Let's say a client requests bogus.html from a stand alone web server. If the web server does not contain a file named bogus.html, the web server will respond with http status code 404 - not found.

 

By default, nearly all web servers are configured to display 404 in the browser.

 

Or, you can check for 404 in the web servers access log.

2018-09-26 01:38:02 10.1.2.3 www.example.com GET "/bogus.html" HTTP/1.1 404

 


Stand Alone Tomcat Application Server

Similar to a stand alone web server, a stand alone Tomcat application server will respond with http status code 404 if the resource being requested does not exist. For example, let's say http://tomcat.com/example.html is requested directly from the Tomcat server. If example.html does not exist on the Tomcat server, then 404 will be returned. If example.html does exist on the Tomcat server, check catalina.out and catalina.log for issues.

 


Web Server + Proxy Pass + Tomcat

Diagnosing http response 404 is more tricky when a web server is configured to proxy requests to Tomcat. Typically, this is done using Proxy Pass.

For example, let's say www.example.com is a web server that fronts Tomcat. When a request is submitted to www.example.com, the web server will hand the request off to the proxy pass, and then the proxy pass will request the resource from Tomcat. If the web server and the proxy pass and Tomcat are properly configured, the requested resource will be sent to the client. In this example, index.jsp was requested, and was successfully sent to the client.

 

If 404 is being returned, you usually want to check the following.

 

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments