title: how to forward request from apache to s3
body: <p>I have a hosted website on fasthost DNS provider with the name <code>mywebsite.com</code>. Any request to mywebsite.com gets forwarded to a running on aws EC2 instance on which my web application is running. In the EC2 instance, I have setup Apache http server that takes all the requests and forward to my web application with the help of the following virtual host setting in the apache <code>httpd.conf</code> file</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
       ProxyPreserveHost On
       ProxyRequests Off
       ServerName mywebsite.com
       ProxyPass / http://127.0.0.1:8080/
       ProxyPassReverse / http://127.0.0.1:8080/
  &lt;/VirtualHost&gt; 
  </code></pre>
  
  <p>So far this is working fine. Now I have static image which I have hosted on aws S3 bucket. The publicly accessible url is <code>https://s3.eu-west-2.amazonaws.com/static/images/some-img.png</code></p>
  
  <p>I do not want the S3 domain-name appear and would like to mask <code>s3.eu-west-2.amazonaws.com</code> server name so instead of <code>https://s3.eu-west-2.amazonaws.com/static/images/some-img.png</code> I have something like 
  <a href="https://mywebsite.com/static/images/some-img.png" rel="nofollow noreferrer">https://mywebsite.com/static/images/some-img.png</a>
  I tried adding the Virtual host entry in httpd.conf so that any request with context <code>/static</code> gets forwarded to S3 instance. but it doesn't seem to be working:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
       ProxyPreserveHost On
       ProxyRequests Off
       ServerName mywebsite.com
       ProxyPass /static https://s3.eu-west-2.amazonaws.com/
       ProxyPassReverse /static https://s3.eu-west-2.amazonaws.com/
  &lt;/VirtualHost&gt; 
  </code></pre>
  
  <p>Any idea if this is at all possible?</p>
  
  <p><strong>Update</strong>
  I modified the VirtualHost to </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
       ErrorLog logs/mywebsite.com-error_log
       ProxyPreserveHost Off
       ProxyRequests Off
       ServerName mywebsite.com
       ProxyPass /static https://s3.eu-west-2.amazonaws.com/mywebsite-static-repo
       ProxyPassReverse /static https://s3.eu-west-2.amazonaws.com/mywebsite-static-repo
  
  &lt;/VirtualHost&gt; 
  </code></pre>
  
  <p>Where <code>mywebsite-static-repo</code> is the name of the bucket. The <code>mywebsite.com-error_log</code> gives the following error:</p>
  
  <pre><code>File does not exist: /var/www/html/mywebsite-static-repo
  [warn] proxy: No protocol handler was valid for the URL /static/mywebsite-static-repo/images/some-img.png. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
  </code></pre>