title: Apache ProxyPassReverse not rewriting Location header properly
body: <p>I'm configuring apache to proxy SSL requests to a local backend server. Here are the relevant parts of the virtual host:</p>
  
  <pre><code>&lt;VirtualHost *:443&gt;
  
    ...
  
    SSLEngine on
    SSLCertificateFile /path/to/server.crt
    SSLCertificateKeyFile /path/to/server.key
  
    RewriteEngine On
  
    &lt;Proxy balancer://unicornservers&gt;
      BalancerMember http://127.0.0.1:8080
    &lt;/Proxy&gt;
  
    # Redirect all non-static requests to unicorn
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
  
    ProxyPassReverse / balancer://unicornservers/
    ProxyPreserveHost on
  
    ...
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>When I use curl to access the server (<code>curl -vk https://example.com</code>), the backend server performs a redirect to <code>/login</code>, as it is supposed to.</p>
  
  <p>The problem is, apache is not rewriting the <code>Location</code> header properly. It returns a location of <code>http://example.com/login</code> instead of <code>https://example.com/login</code>.</p>
  
  <p>Is there somewhere in my config where I need to tell apache to use <code>https</code> for the <code>ProxyPassReverse</code> rewrite?</p>