Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7536373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:33:24+00:00 2026-05-30T06:33:24+00:00

Grails 2.0 changed with the way it uses grails.serverURL for development and test environments

  • 0

Grails 2.0 changed with the way it uses grails.serverURL for development and test environments (as described in the manual). However, I’ve had several problems with serverURL in regard to production deployment on Tomcat. There seem to be several options for serverURL (production mode):

  • (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.

  • Use it to specify the server (as is pointed out as a “TODO” in Config.groovy)

  • Don’t use it as indicated here 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).

  • Use another method instead, namely grails.app.context, which is not documented in Grails 2.0 manual, but is described in certain references, here and here.

Can you please clarify the correct use of serverURL and app.context, both for Jetty and Tomcat (production mode)?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:33:26+00:00Added an answer on May 30, 2026 at 6:33 am

    So the basic idea of the grails.serverURL configuration parameter is to allow the createLink method to know what URL you want when creating absolute links. If no grails.serverURL configuration parameter is specified, it will default to http://localhost:8080 (unless server.port is specified, then 8080 will be whatever) …

    The application context tells Jetty/Tomcat to run the application in a different root. For example, specifying

    grails.app.context="/myApp"
    

    will set your application root to “/myApp”. In production mode, the application context is handled by the web container and this directive is ignored. The choice to configure your production jetty or tomcat instances to run your application in a different context is entirely dependent on what your technical requirements are.

    So the real thing to consider is, in your application are you creating a lot of absolute links in your GSPs where you need to define a “production” serverURL? If not, then you don’t need to specify it; if you are, then you’ll need to specify it.

    As a personal preference, the first thing that I always do after creating a new grails project is go into the config and change the grails.app.context to “/” … It makes mirroring a production environment much easier for me.

    Hope this clears things up!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Grails makes it very easy to configure datasources for different environments (development, test, production)
I am working on a grails application which uses Amazon's SimpleDB. I changed a
What is the best way to load seed (initial or test) data into grails
Grails tends to write out the URL for everything that uses its tags as
Is there a way to customize the directory where grails install-plugin installs a plugin?
is there a way to use Grails in exploded mode on tomcat in order
I'm half way through writing my first grails app. It's going really well so
We're running into transaction issue with Grails. During performance test we have a scenario,
Yes, several similar threads exist, but we're now in 2011, and much has changed.
In grails, is there a way in the i18n file to reference a constant

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.