开发者

Grails URL's with Tomcat/Apache ProxyPass

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

<scri开发者_运维百科pt 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜