Mar 24th, 2013, 03:50 PM
One Spring MVC application through multiple domain names
I have a design challenge that is all new to me and i'm looking for input:
We have a Spring MVC application that currently runs in Tomcat on a single domain name. We're bringing in new customers and i need to find a way to set things up so that the application is reached through their domain name. What i mean is that the application sits at www.application.com and a call to www.cust1.com/somepage.htm or www.cust2.org/somepage.htm is redirected to www.application.com/somepage.htm. Someone suggested we use Apache to "funnel" the calls from multiple domain names into one. Is that a good solution? Does Tomcat have anything similar that can be used?
Also, i need to find a way to figure out through which domain the original call (before redirection) was made, so that i can set any links in the rendered page to the right domain name and also link to different stylesheets based on where the call came from. I would like to do this in a way that does not require every controller method to dig out the domain name from the http request. An idea i have been thinking about is to have an interceptor pick up the domain name and set a variable that is available to all JSP pages as well as all controller methods to set link URLs, css references and any other logic based on the origin of the call. Is this possible and a good solution?
If anyone has any experience or tips or any suggestions, it would be highly appreciated. We use Spring security and the design must not interfere with that.
Tags for this Thread