views:

308

answers:

2

Grails tends to write out the URL for everything that uses its tags as /appName/whatever. For instance, if I use the tag:

<g:javascript library="jquery"/>

the resulting tag is

<script src="/appName/jquery/jquery.js"></script>

This causes an issue with using ProxyPass with Apache/Tomcat. All of my CSS, JS, Images and links have that /appName prefixed to them.

Is there a way to work around this with ProxyPass or possibly a way for Grails to not prefix the appName to the front of all of my URL's?

+1  A: 

That works for me, are you trying to run the app as domain.com/ rather than domain.com/appName?

If so, then you'll probably need to specify the base or absolute parameter in the tag.

tgm
Yes, I was trying to run it as domain.com. So everything is ending up with /appName prefixed to it, which causes an issue. The problem is with the g:javascript tag, it doesn't accept the absolute param. I'm wondering if there is a way to tell tomcat that I'm access stuff by / instead of /appName?
intargc
A: 

If you don't have another application running as default in your tomcat, or you don't care about replacing it, you must rename you war file to ROOT.war before deploying it. (and delete the directory ROOT if it exists)

If you have severals applications and only one tomcat server, you can use virtualhosts. One virtualhost for each application. (http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html)

If you choose the virtualhosts approach, you must use de virtualhost domain when you define ProxyPass sentences and be sure that the apache server, resolves the virtualhost domain correctly. (if not, you may need to edit he os hosts file)

Sorry about my english.

Fernando