whitenexx
whitenexx

Reputation: 1370

Multiple or many domains with one grails application?

I have one grails application and i want to bind many topleveldomains to it.

So for example: A user of my application can add a domain name to his profile and after that he has to add the IP as A-Record to his DNS-Server. Visiting the domain now results in a special webseite, with content of his profile. So for each domain you get different content from the grails application delivered.

How would you realise such funcionality? Does the app have to create vhosts?

Upvotes: 1

Views: 158

Answers (1)

Georgemc
Georgemc

Reputation: 369

Have your controllers examine the request headers and make decisions based on that.

def action = {
    def serverName = request.serverName
    def content = MyContentClass.findByDomain(serverName)
    [model: content.getContent()[
}

Something like that.

Upvotes: 3

Related Questions