Reputation: 67892
I have an Apache server proxying all traffic from mainhost.com/subdirectory
to someec2instance/subdirectory
. When I start Apache and hit someec2instance.com
, I get the ROOT war page. That works fine. If I deploy my app as ROOT.war, everything works fine form someec2instance.com
.
However, when I access mainhost.com/subdirectory
, all the asset urls and link_to
urls are wrong and point to mainhost.com
instead of mainhost.com/subdirectory
.
I've set grails.app.context
and confirmed via application.properties
that the correct grails.env
is being set.
Why isn't grails.app.context
being respected when I deploy as ROOT.war
? I would expect the site to be accessible on someec2instance.com/context
, but it's like it ignore grails.app.context
entirely.
Upvotes: 2
Views: 309
Reputation: 75681
The reason is doesn't work is that those settings are for running locally, not when deployed as a WAR file. When you use the tomcat or jetty plugin in run-app
we configure the container to make it look like it's running an "exploded" war (similar to when a WAR gets unpacked to the file system by various servers). Since the container is running in embedded mode, it's easy to configure it programmatically as needed.
But when you deploy a WAR file there's nowhere near as much configurability. In run-app
the build logic of Grails starts the server, configures it, and deploys the app, but a WAR file deployed to a "real" server is managed by the server and not the other way around.
Upvotes: 4