简体   繁体   中英

grails.serverURL with Nginx doesn't work properly

I have my Grails 2.1 Application running within a Tomcat 7.x container. It's called ROOT.war. Nginx takes care for routing. Both components are on their own Ubuntu 12.4 servers.

The grails.serverURL in Config.groovy is set to the prod Domain www.myproddomain.com. So far, everything works perfect.

If I now want to test the Grails App before I activate the tomcat in Nginx, so I tried to use the internal URL from the server such as internalipofserver:8080. This works, but since the grails.serverURL is set to www.myproddomain.com, I cannot click around without beeing redirected to www.myproddomain.com which makes no sense to test then.

If I now leave grails.serverURL away, the preview on internalipofserver:8080 works fine, but as soon as I activate this tomcat in nginx to be reachable under www.myproddomain.com, certain resources will be pulled from internaliofserver:8080.

It seems to me as of tomcat would kind of store the first address that the site was called and then use that url.

Can you advise? Thank you. Best Sullivan

grails.serverURL does not have anything to do with the outside url (except for absolute links generated from grails). You can configure your nginx to handle any domain and internally do the proper redirects.

The caching you have described is probably due to the browser cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM