TeamCity behind an Apache reverse proxy using SSL

I am using TeamCity behind an Apache reverse proxy. Apache is also used to handle https connections and the requests are forwarded using HTTP to TeamCity. This works great with some wired exceptions.

For example: Clicking the "Administration" link redirects not the HTTPS link but to the HTTP link. While the browser shows the link as HTTPS when hovering with the mouse over it after clicking it the URL is an HTTP URL. This also happens for some other links in TeamCity. The strange thing is, that most of the links work just fine. I set the base URL of TeamCity to https://teamcity.... but this did not help.

Can anyone help me on this?

Thanks

-- Update

I had a look at the network logs of chrome and found the following:

The request for "https://teamcity.tde.at/teamcity/admin/admin.html" returns 302 with the new location "http://teamcity.tde.at/teamcity/admin/admin.html?init=1&item=projects" while this should be "https://teamcity.tde.at/teamcity/admin/admin.html?init=1&item=projects"

 

7 comments
Comment actions Permalink

Hi Alexander,

It looks like misconfiguration in HTTPS-to-HTTP redirect. Please check that Apache proxy server is configured correctly: https://confluence.jetbrains.com/display/TCD9/How+To...#HowTo...-Apache.

0
Comment actions Permalink

Double checked that. The configuration is exactly the one stated in the documentation.

The strange thing is that TeamCity creates redirects starting with http instead https. At least I think it does.

Alexander

0
Comment actions Permalink

Sorry about bringing this up again...

I got Teamcity running in a tomcat7 installation accessable via port 8080 and I'd like to use an apache2 proxy on the same machine to serve via a subdomain.
So therefore:
http://teamcity.example.com:8080/teamcity gets me to the teamcity installation

http://teamcity.example.com is supposed to get the same location.
My vhost.conf for apache looks like this:

  ProxyPass / ajp://localhost:8009/teamcity/
  ProxyPassReverse / ajp://localhost:8009/teamcity/

Entering: http://teamcity.example.com/ to my browser always redirects me to: http://teamcity.example.com/teamcity/login.html and ends in a 404 error.

Entering http://teamcity.example.com/login.html gets me to the login page but without any stylesheets applied and the login fails.

What am I missing out? I'd like to serve teamcity via subdomain and not add the directory.
Moving teamcity to tomcats ROOT is not an option, after I run in the same problem as soon as I want to serve other tomcat apps.

Thanks for any help.

0
Comment actions Permalink

Hi Felix,

Please try to set up Apache proxy server the same way as proposed in the documentation: https://confluence.jetbrains.com/display/TCD9/How+To...#HowTo...-Apache.

0
Comment actions Permalink

Alright. So my vhost.conf looks like this:

  ProxyRequests Off
  ProxyPass /teamcity/app/subscriptions ws://localhost:8080/teamcity/app/subscriptions connectiontimeout=240 timeout=1200
  ProxyPassReverse /teamcity/app/subscriptions ws://localhost:8080/teamcity/app/subscriptions

  ProxyPass / http://localhost:8080/teamcity/ connectiontimeout=240 timeout=1200
  ProxyPassReverse / http://localhost:8080/teamcity/


Opening http://teamcity.example.com redirects me to: http://teamcity.example.com/login.html and shows the login page without applying stylesheets and images.

My browsers dev-console has a 404 for opening stylsheets at: https://teamcity.example.com/teamcity/...

Any ideas?
Thanks for the help.
0
Comment actions Permalink

Hello,

Please try the following config:

LoadModule  proxy_module          /usr/lib/apache2/modules/mod_proxy.so
LoadModule  proxy_http_module     /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule  headers_module        /usr/lib/apache2/modules/mod_headers.so
LoadModule  proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so

ProxyRequests       Off

ProxyPass           /app/subscriptions ws://localhost:8080/app/subscriptions connectiontimeout=240 timeout=1200
ProxyPassReverse    /app/subscriptions ws://localhost:8080/app/subscriptions

ProxyPass           /     http://localhost:8080 connectiontimeout=240 timeout=1200
ProxyPassReverse    /     http://localhost:8080

0
Comment actions Permalink

This just gets me to the tomcat7 root directory "It works" site.

For now, I added a second proxy.

One for "/" and one for "/teamcity" so the site is reachable by its subdomain and will redirect everything with /teamcity.

Works for us although it has the name doubled in the url: teamcity.example.com/teamcity

0

Please sign in to leave a comment.