0

On a tomcat 7 server, we've configured a https connector, the TLS certificate is valid for an URL like www.example.com . Now we want to change the A record of one of our subdomains (like foo.bar.com) to point to the tomcat server.

How can I rewrite/process incoming requests from foo.bar.com to use https://www.example.com in order to prevent users from getting certificate errors shown in the browser?

Deer Hunter
  • 1,070
  • 7
  • 17
  • 25
Mr.Radar
  • 133
  • 1
  • 6

1 Answers1

0

Stand up an Apache server (or virtual host) at foo.bar.com, and have it proxy connections to www.example.com:

<VirtualHost *:80>
  ServerName foo.bar.com
  ProxyPass / https://www.example.com/
  ProxyPassReverse / https://www.example.com/
</VirtualHost>

But this won't completely work if the HTML returned from www.example.com includes links with absolute references to URLs starting with www.example.com. In that case you'll need to use something like mod_proxy_html to rewrite the links within the content.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
  • One of our goals is to get rid of foo.bar.com's VM, therefore a solution which could be realized on www.example.com's VM, ideally within Tomcat's scope, would be preferred. Any hints? – Mr.Radar Oct 22 '14 at 07:56
  • 1
    The above can run on Tomcat's VM, but it does assume Apache listening on port 80. – Andrew Schulman Oct 22 '14 at 08:02