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 7441833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:04:49+00:00 2026-05-29T11:04:49+00:00

Does Grails know anything about sub-domains (i.e. subdomain.domain.com) ? I don’t see it discussed

  • 0

Does Grails know anything about sub-domains (i.e. subdomain.domain.com) ? I don’t see it discussed in the manual. Is this purely an app server/web server issue? Can be tied into grails controllers, either statically or dynamically?

  • 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-29T11:04:50+00:00Added an answer on May 29, 2026 at 11:04 am

    It does not matter which host is accessed for a java web application.

    1. Supposing you have multiple clients separated on one host, e.g. customer1.yourhost.com, customer2.yourhost.com, etc. and all clients will have same functionalities.

      In the simplest case I propse, that you just use write a filter, which will always put some request variable, like this:

      def filters = {
          all(controller:'*', action:'*') {
              before = {
                  if (request.serverName.contains(".")) {
                      def clientName = 
                        request.serverName.substring(0, request.serverName.indexOf("."))
      
                      request.currentClient = Client.findByClientName(clientName) // e.g.
                  }
              }
          }
      }
      

      Then at any place you can check request.currentClient for the current accessed subdomain.

      However if it gets more complicated have a look at some multi-tenant plugins for grails.

    2. If you want to have different functionalities for each subdomain e.g. help.yourhost.com and http://www.yourhost.com, I would propose that you write independent grails applications. You then setup a NGINX server to redirect those requests to the appropriate application running on your application server.

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

Sidebar

Related Questions

I am porting over Grails project to STS and I don't know much about
Does anyone know how to initiate a POST request in a Grails applications using
Does anybody know how to (easily) rename an existing grails application? I'm running into
I know this is something of a classic question, but does the mysql/grails (deployed
I know Grails has a map based constructor for domain objects, to which you
does anybody know a possibility to show the Unit-Test results of a grails project
Does anyone know about a good HTML editor which can be configured in such
Does anybody know any good resources for learning how to program CIL with in-depth
Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone know how to transform a enum value to a human readable value?

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.