Domain – Tomcat Redirect Changes URL

domainmultiple-instancesredirecttomcat

I was originally going to post this on StackOverflow but decided that it might be more appropriate here, apologies if I'm wrong. Also, I can only apologise that this question will be pretty low on useful information. I'm working on an installation of Tomcat 5.5.15, over which I have limited control. I'll describe the symptoms of my problem and hope the solution is obvious to someone who knows better than me. I've not found any useful solutions elsewhere online, but that's probably because I'm not searching for the right things…

The set up I'm working with is as follows (names changed to protect the innocent):

1 server ('jones')

This server has 3 instances of Tomcat running on it, let's call them 'andy', 'brian' and 'charlie'. Each instance has a set of the same web applications deployed (or, almost the same – they form different non-production environments for a bunch of tools).

I don't know much about 'andy' – I haven't really used that environment at all.

Everything works fine on 'brian'.

My problem is that, on 'charlie', whenever I encounter a redirect, my browser (same in IE, Firefox and Chrome) is redirected to 'brian:port', where port is the port for charlie, as specified in charlie's server.xml.

After that everything works fine, except that my session is gone, presumably because of the change when it redirected.

I'm not familiar enough with the Tomcat config to know where to look for more useful information – any pointers are very welcome. All I want is for redirect to come back as http://charlie/blah, rather than http://brian:port/blah.

Best Answer

Look for a <Host> block in charlie's server.xml.

What'd doing the redirecting? I'd be inclined to say to take a look at the web app; it may well have something hardcoded for the hostname somewhere instead of using the host that the request came in on.