Ssl – Apache forward proxy HTTP requests to arbitrary AWS S3 buckets over HTTPS

apache-2.4PROXYssl

This is a rewrite of my original post. I still banging my head trying to figure out how to get a custom client (Windows service that only speaks HTTP, does not support HTTPS) to upload files to Amazon AWS S3 buckets via an Apache 2.4 proxy. Since the client doesn't support HTTPS, I want it to access arbitrary S3 buckets via HTTP and have the Apache proxy transparently use HTTPS between itself and the S3 buckets, e.g. HTTPS://bucket-name.s3-aws-region.amazonaws.com, to handle the file uploads. A simple rewrite has so far not worked. This wouldn't be a redirect (mod_proxy [R,L] flags) since I don't want to redirect the client to the HTTPS URL since it can't do SSL.

I can do this for a single bucket using a reverse proxy, but I don't see how to use a reverse proxy for an arbitrary number of unspecified buckets since it's the domains that matter in the ProxyPass and ProxyPassReverse settings.

Is what I'm trying to do even possible? It feels like it should be…

Best Answer

This is absolutely possible, and does not require Apache on the proxy server to have an SSL key as you say (as the interaction with that server is carried out via HTTP).

You essentially just need to use a fairly basic proxy configuration similar to the following as an example:

<VirtualHost *:80>
    ServerName yourintendedname.com
    SSLProxyEngine On
    ProxyPreserveHost on
    ProxyPass / https://upstreamserver.com:443/
    ProxyPassReverse / https://upstreamserver.com:443/
</VirtualHost>

The above configuration takes all traffic requested traffic to yourintendedname.com and passes the requested URI as-is to upstreamserver.com via https.

Now, the issue you will potentially note (and why I requested more detail in your question) is that the fact that the requested URI will be passed up to the server to be proxied to as-is may well cause problems. You alone will be able to figure out a solution to this for your individual circumstances.