Tomcat – Configure IIS 7 Reverse Proxy to connect to TeamCity Tomcat

iis-7reverse-proxyrewriteteamcitytomcat

We have an IIS 7 webserver configured and would like to create a reverse proxy for a TeamCity installation using Tomcat on the same machine.

The IIS server site is https://somesite and I would like the TeamCity to appear as https://somesite/teamcity redirecting to http://localhost:portnumber.

I have installed the IIS URL Rewrite extension and the Application Request Routing to try and setup a reverse proxy but can't get it working.

The closest answer I found is an old StackOverflow question:
https://stackoverflow.com/questions/331755/how-do-i-setup-teamcity-for-public-access-over-https
which unfortunately doesn't have any working example.

I've searched a quite a bit but can't seem to find a relevant example.

Any help is appreciated!

Best Answer

Having just spend around 4 hours trying to configure SSL for TeamCity (and using the answers in this thread), I managed to get this working using the server farm option.

  • I configured a TeamCity server farm which included my TeamCity server on 127.0.0.1 using port 8080, and allowed the Application Routing Rules to create a corresponding server farm routing rule.

  • I then created a website called TeamCitySecureProxy which I configured with a self-signed certificate. On the bindings I only configured https/443 (no http/80).

  • The part I was missing:- I then clicked on the 'TeamCity' node under 'Server Farms' in IIS, choose 'Proxy' from the 'Server Farm' pane, and ticked the 'Reverse rewrite host in response headers'.

I now have a secure end-point for accessing my plain http TeamCity installation.