About deploying Ember app in Apache Tomcat

Scenario

  • I have an ember app which fetches data from a tomcat server through ajax calls.

  • When I changed the Ember location Type to history from hash tomcat server throws 404 Exception to my router URL.

Example

I don’t know how to handle those router URLs with the servlet-mapping.

I’m not sure how to do this with tomcat specifically but you basically want to rewrite all requests to index.html. Basically you’re letting the javascript app “handle” the urls instead of the server. So in the case of /base you want the server to let the webapp (which is at index.html) handle the request instead of the server looking for /base.html or /base/index.html or whatever it’s doing by default. Any single page application (SPA) would require this sort of configuration so maybe if you do some searching for “tomcat SPA” or something you can find some tomcat-specific resources.

1 Like