Reputation: 1007
We're using Spring Boot and I've created a WAR, instead of a JAR, to deploy on a regular Tomcat server. All seems to work fine, except it appears that the context path isn't being set properly. Any relative paths in my index.html are not working.
When loading the app in a browser, this link,
<link type="text/css" rel="stylesheet" href="app.min.css" />
is attempted to be loaded from http://localhost:port/app.min.css instead of http://localhost:port/contextpath/app.min.css". Trying to set this in application.properties does not work as it looks like this value only works for the embedded Tomcat server.
Upvotes: 6
Views: 10935
Reputation: 8774
As you've already guessed the server.context-path
property as well as all the other server.*
properties apply to the embedded tomcat only. If you deploy to an external tomcat using WAR packaging you have to configure those values in the external tomcat itself.
The way we usually do this here is to have a context descriptor in ./conf/Catalina/localhost/
with a name that equals your expected context path, i.e. contextpath.xml
according to the docs.
Upvotes: 8