title: grails 2.0 - correct use of serverURL for production?
body: <p>Grails 2.0 changed with the way it uses grails.serverURL for development and test environments (as described in the <a href="http://grails.org/doc/2.0.x/guide/single.html#upgradingFromPreviousVersionsOfGrails" rel="nofollow noreferrer">manual</a>).  However, I've had several <a href="https://stackoverflow.com/questions/9187891/grails-2-0-deploying-war-to-remote-server-tomcat-not-connecting">problems</a> with serverURL in regard to production deployment on Tomcat.  There seem to be several options for serverURL (production mode):</p>
  
  <ul>
  <li><p>(Added) this setting is just "smoke and mirrors", because Tomcat and Jetty have methods to control how the URL is handled for the App, down to the "App" level.</p></li>
  <li><p>Use it to specify the server (as is pointed out as a "TODO" in Config.groovy)</p></li>
  <li><p>Don't use it as indicated <a href="https://stackoverflow.com/questions/8933356/how-do-i-set-grails-serverurl-in-an-enterprise-environment-when-i-dont-know-the">here</a> by one of the Grails contributors, i.e. "It should always be safe to remove the serverURL property and let Grails generate urls relative to the current running app."  It's not clear if this extends to production or not (when not generating emails).</p></li>
  <li>Use another method instead, namely grails.app.context, which is not documented in Grails 2.0 manual, but is described in certain references, <a href="http://ca.rroll.net/2009/03/27/configuring-the-grails-root-application-context/" rel="nofollow noreferrer">here</a> and <a href="http://jira.grails.org/browse/GRAILS-2534" rel="nofollow noreferrer">here</a>.</li>
  </ul>
  
  <p>Can you please clarify the correct use of serverURL and app.context, both for Jetty and Tomcat (production mode)?</p>
  
  <p>Thanks</p>