I want to proxy from my Amazon S3 bucket like this:
This url:
http://www.mysite.com/page1
Proxy from this url:
http://mys3.bucket.com/www.mysite.com/page1
This is working with this rule
RewriteRule .* http://mys3.bucket.com/%{HTTP_HOST} [P]
However, the complication occurs when the url contains a query string.
This url:
http://www.mysite.com/page1?search=asdf
Should proxy this url:
http://mys3.bucket.com/www.mysite.com/page1?search=asdf
To work with S3, that needs to be encoded like this so that the query string is part of the key:
http://mys3.bucket.com/www.mysite.com/page1%3Fsearch%3Dasdf
Note that only the ?
and =
should be encoded. %
in the keys for values should be left alone.
How can you do this with Apache?