Reputation: 2621
Basic question is do we need to run our war as ROOT.war to get the context path correct with spring security?
Background:
We have a grails application that is using spring security plugin. It is proxied by nginx and the war is NOT running as ROOT.war in tomcat.
Web site: https://www.example.com
Login: https://www.example.com/login
War name is foo.war and nginx is proxying requests to http://tomcat:8080/foo
Spring security is using: ${request.contextPath}
Do we install the app as a ROOT.war or is there a context path variable in grails spring security that we can modify?
The spring security auth cookies are being set with /foo in the path ... and our session management in not working correctly.
Upvotes: 0
Views: 2259
Reputation: 2621
@Ian-Roberts is correct.
You cannot just use grails.app.context = '/foo'
or grails.app.context = '/'
. I appears that Tomcat is messing with the applications context, ergo you have to run it as ROOT.war.
Instructions:
grails.app.context = '/'
in Config.groovy in order to do grails run-appROOT.xml in $TOMCAT_CONF/Catalina/localhost
<Context path="" antiResourceLocking="false" privileged="true" >
<Resource name="jdbc/****x"
auth="Container"
type="javax.sql.DataSource"
maxActive="300"
edited :)
/>
<Resource name="jdbc/***"
auth="Container"
edited :)
/>
</Context>
Because I was getting URL Mapping Errors. Oh and do not try to run the war outside of the AppBase, because tomcat will not expand it and all hell will break out :)
Upvotes: 1