revers proxy http -> https?
You can do it with apache.
First, you need to load the ssl, proxy, proxy_http and proxy_html modules.
Then, you need a proxy setting like this:
<VirtualHost 0.0.0.0:80>
ServerName give_it_a_name
SSLProxyEngine on
ProxyPass / https://your-test-server/
ProxyPassReverse / https://your-test-server/
ErrorLog /the/error.log
</VirtualHost>
Of course you don't need a VirtualHost for this, you can embed the ProxyPass* and the SSLProxy* directives to any other host definition.
Note that the certificate has to be signed by a trusted authority. If you use self-signed certificates, you have to supply them using the
SSLProxyCACertificateFile /the/pem/file
or the
SSLProxyCACertificatePath /the/dir/where/the/cert/files/are
directives.
Also, Apache checks if the name of the remote host is the same as the one the certificate issued to. You can disable this behavior by adding the
SSLProxyCheckPeerCN off
line to your config. For further settings, you may want to check the Apache docs.
If your test server has HTTP enabled you can simply proxy to that protocol (assuming apache and mod_rewrite):
RewriteEngine On
RewriteRule ^/foo(.*)$ http://testserver.example.org/$1 [P]
If there's nothing listening on the unencrypted HTTP port you can't just strip the SSL away.
RewriteEngine On
RewriteRule ^/foo(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R]