I am trying to deploy Grails 2.2.3
project to a production and having issue with URL.
I setup reverse proxy in Apache and have http://example.com -- as example.
I set following property in Config.groovy
:
grails.serverURL = "http://example.com/"
and set in the application.properties
following:
app.context=/
However all of my resources and links always reference to
http://example.com/AppName/...
How do I remove application name ("AppName") from resource and links reference?
Example of resources:
<r:require modules="bootstrap"/>
<g:javascript library="jquery"/>
Example of environments Config.groovy:
environments {
development {
grails.logging.jul.usebridge = true
}
production {
grails.logging.jul.usebridge = false
grails.serverURL = "http://example.com/"
grails.app.context = "/"
}
}
I think Grails application must have some sort of property that could be set!? Otherwise it seems like a pain the neck.
Please help!
P.S: If I access any resource directly (manually remove AppName from URL) I get the right stuff such as css, js and image.
Update: I set following in application.properties:
app.context=/
serverURL=http://example.com/
and created absolute URL in grails:
<g:createLink controller="Sample" absolute="true"/>
and it creates proper URL!!! However resources use relative path and start with AppName/... It seems like a curse, I just can't get rid of that AppName.
Update:
If I run prod run-app
then all URLs come out properly, however the moment I deploy to Tomcat 7, AppName appears in URLs again.