I'm using embedded tomcat 7 behind a iis 7.5 proxy server, with requests being forwarded to tomcat with arr.
Everything works fine unless iis is set to require ssl.
Then things like links that are generated dynamically in .jsp
files on tomcat don't work right. For example if a link is supposed to point to https://somewhere.com:443
it will be written as http://somewhere.com:8080
(8080 is the port tomcat is running on).
The problem seems to come from when tomcat looks at itself to build out the url it sees correctly that it is running on http://somewhere.com:8080
, but I need it to think otherwise.
Does anybody know how to accomplish this without using ssl between iis and tomcat?
Best Answer
This problem is due to Tomcat not knowing the actual external
URL
of the application. When the application redirects to a relative URL, the Servlet add the full absolute URL to Location (as required).If you are using
HTTP
betweenIIS
and Tomcat, Tomcat thinks you are usingHTTP
and generateshttp://...
absoluteURL
.The solution is not using
HTTP
(norHTTPS
) betweenIIS
and Tomcat.You should use
AJP13
protocol and theTomcat-ISAPI Redirector
onIIS
.Here is the official Tomcat+IIS how to.
Using Apache as proxy you could use HTTP for proxying, but you need configure Apache's
mod_proxy
and tell Tomcat it is behind a proxy. Here is a how to on that process.