Spring security plugin and url_rewrite

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Spring security plugin and url_rewrite

Rossi Davide
Hi,

I'm changing the prod environment for my Grails app, putting apache in front of tomcat and I am facing 2 problems.

The first is a problems with URLs: the link tag sometimes writes the context in the link and I could not find a way to fix it. I tried to add grails.app.context="/", but this works in localhost and not in production.
Is there a way to make grails write ALL the URLs without the context ? Now I use mod_proxy with url_rewrite to remove the context from the URL.
You can see this looking at the production site (www.bettinglife.it): if you put the mouse over a link in the menu you can see the link with the context (for example http://www.bettinglife.it/QuoteWeb-0.1/variazioni-quote-scommesse instead of http://www.bettinglife.it/variazioni-quote-scommesse)

The second problem is with the spring-security plugin and I think it is related to the first.
I have a private admin area, and when I log in everything works fine, the user is authenticated correctly. The problem is that when I change the page the user in the session is lost, probably due to rewrite of the URL.
This is not a blocking problem now, as I can directly access the tomcat instance for the administration, but will be a blocker in future as I'm working on a public reserved area of the site.

Can anyone help in any of these two problems ? Am I missing something ?

Ciao
Davide
Reply | Threaded
Open this post in threaded view
|

Re: Spring security plugin and url_rewrite

Ian Roberts
On 16/02/2012 12:09, Rossi Davide wrote:

> The first is a problems with URLs: the link tag sometimes writes the
> context in the link and I could not find a way to fix it. I tried to add
> grails.app.context="/", but this works in localhost and not in production.
> Is there a way to make grails write ALL the URLs without the context ?
> Now I use mod_proxy with url_rewrite to remove the context from the URL.
> You can see this looking at the production site (www.bettinglife.it
> <http://www.bettinglife.it>): if you put the mouse over a link in the
> menu you can see the link with the context (for example
> http://www.bettinglife.it/QuoteWeb-0.1/variazioni-quote-scommesse
> instead of http://www.bettinglife.it/variazioni-quote-scommesse)

Call the WAR file ROOT.war instead of QuoteWeb-0.1.war and Tomcat will
treat it as the root context.  You should also set grails.serverURL =
"http://www.bettinglife.it" in your Config.groovy (probably in the
environment-specific section) if you haven't already in order to get
absolute <g:link>s to work.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Spring security plugin and url_rewrite

Rossi Davide
Thank you,

but renaming the WAR is not an option  (at least for now, if it's the only solutions I can think about it).
Also, I have the grails.serverURL property set, but the context is added anyway.

Davide

On Thu, Feb 16, 2012 at 1:16 PM, Ian Roberts <[hidden email]> wrote:
On 16/02/2012 12:09, Rossi Davide wrote:
> The first is a problems with URLs: the link tag sometimes writes the
> context in the link and I could not find a way to fix it. I tried to add
> grails.app.context="/", but this works in localhost and not in production.
> Is there a way to make grails write ALL the URLs without the context ?
> Now I use mod_proxy with url_rewrite to remove the context from the URL.
> You can see this looking at the production site (www.bettinglife.it
> <http://www.bettinglife.it>): if you put the mouse over a link in the
Call the WAR file ROOT.war instead of QuoteWeb-0.1.war and Tomcat will
treat it as the root context.  You should also set grails.serverURL =
"http://www.bettinglife.it" in your Config.groovy (probably in the
environment-specific section) if you haven't already in order to get
absolute <g:link>s to work.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email