HowTo: ReverseProxy to https in Apache

To enable reverse proxy (for http and https) you need these modules enabled in Apache:

  • mod_proxy
  • mod_proxy_http
  • mod_proxy_connect

When you reverse proxy requests to http, add following lines to Apache configuration file:

ProxyPass /abc http://test.com/xyz
ProxyPassReverse http://test.com/xyz /abc

This is proxy all the content on /abc to http://test.com/xyz. So when you access /abc you will see the contents of http://test.com/xyz.

But to reverse proxy https content you need a CA certificate. The CA certificate is the same certificate that the server uses to serve https content.
You need to add these lines in Apache configuration file:

SSLProxyEngine On
SSLProxyCACertificateFile ssl/certificate.pem
ProxyPass /abc https://test.com/xyz
ProxyPassReverse https://test.com/xyz /abc

For more details: http://www.apachetutor.org/admin/reverseproxies

Advertisements

2 thoughts on “HowTo: ReverseProxy to https in Apache

  1. Hi there. Do you know how to set up a reverse proxy where the client connects over https, but the proxy connects to the final destination server using http?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s