title: mod_rewrite not working with reverse proxy in vhost
body: <p>All I am trying to do is:</p>
  
  <ul>
  <li>rewrite /static/styles/min.css to /static/styles/min.css.gz</li>
  <li>rewrite /static/scripts/min.js to /static/scripts/min.js.gz</li>
  </ul>
  
  <p>The trick is that those files are on a remote (public) server which I'm reverse proxying to.
  I am doing this so I can workaround the same-origin issue with our javascript, and to speed up delivery in general. The .gz files already exist.
  No matter what I do, I cannot request the .js file and have the .gz file returned.
  I have tried this with numerous different RewriteConds to no avail.
  I have also tried it with RequestHeader unset  Accept-Encoding enabled, and commented out.
  Google PageSpeed keeps telling me that it is not receiving the compressed versions, and when I request using curl and manually setting the "Accept-Encoding: gzip, deflate" header, I continue to receive the non-compressed versions. I cannot put the rewrites in the .htaccess file because the reverse proxy is processed before the .htaccess, and I need the rewrite to already be in effect when the reverse proxy happens. I'm at a total loss.</p>
  
  <p>Here is my non-production setup (I know it needs securing):</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName  ww.test.com
    DocumentRoot "/htdocs/public"
  
    Options +MultiViews
    AddEncoding x-gzip .gz
    AddEncoding gzip .gz
  
    RewriteEngine on
  
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule ^\.js$ $1\.js\.gz [L]
  
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule ^\.css$ $1\.css\.gz [L]
  
    &lt;FilesMatch .*\.css\.gz&gt;
      ForceType text/css
      Header append Content-Encoding gzip
    &lt;/FilesMatch&gt;
  
    &lt;FilesMatch .*\.js\.gz&gt;
      ForceType text/javascript
      Header append Content-Encoding gzip
    &lt;/FilesMatch&gt;
  
    ProxyRequests off
    ProxyPass /static/ http://www.ourCDN.com/ourAccount/environmentName/
  
    &lt;Location /static/&gt;
      ProxyPassReverse /
      #RequestHeader    unset  Accept-Encoding
    &lt;/Location&gt;   
  
    &lt;Directory /&gt;
      Options FollowSymLinks
      AllowOverride All
      Order deny,allow
    &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>