We have a Java/Spring app deployed into Heroku, using the excellent webapp-runner as the Tomcat-lite servlet container. In upgrading from 7.0.27.1 to 7.0.31.1, it seems the behavior for setting a default context path of “/” causes problems with <spring:url> tags. Specifically, with the default context path of “/”, tags like <spring:url value="/foo/bar"/> end up getting rendered as //foo/bar. All browsers I tested on OS X (Chrome, Safari, Firefox), for example, don’t seem to handle those particularly gracefully, and try to load http://foo/bar, resulting in all kinds of chaos.
I can think of two workarounds:
- Specify
--context-path ""argument towebapp-runner– this seems “best” since it corresponds to the 7.0.27.1 behavior - Write the tags as
<spring:url context="" .../>– unsure what additional consequences there might be, considering howSpringUrluses leading slash to determineUrlType.
Are either of these reasonable? If not, is there some other solution I should consider?
webapp-runner-7.0.34.1 has changed the default
--context-pathback to"". If you upgrade, it should fix your issue.