title: ProxyPass and RewriteRule [P] acting differently in regard to http/https
body: <p>I have a working configuration that looks like </p>
  
  <pre><code>ProxyPass /roundcube protocol://127.0.0.1:8080/roundcube
  ProxyPassReverse /roundcube protocol://127.0.0.1:8080/roundcube
  </code></pre>
  
  <p>when I go to</p>
  
  <pre><code>http://www.example.com/roundcube
  or
  https://www.example.com/roundcube
  </code></pre>
  
  <p>both or properly proxied to the server on 127.0.0.1:8080, as expected.</p>
  
  <p>However, I would like to have more control over when the proxying happens, so I would like to use mod_rewrite's [P] option rather than the ProxyPass directive shown above.  I tried the following:</p>
  
  <pre><code>RewriteEngine On
  RewriteRule ^/roundcube$ /roundcube/ [R]
  RewriteRule ^/roundcube/(.*) protocol://127.0.0.1:8080/roundcube/$1 [P]
  ProxyPassReverse /roundcube protocol://127.0.0.1:8080/roundcube
  </code></pre>
  
  <p>With that configuration, when I go to </p>
  
  <pre><code>http://www.example.com/roundcube
  </code></pre>
  
  <p>the request proxies correctly as expected.</p>
  
  <p>BUT when I go to </p>
  
  <pre><code>https://www.example.com/roundcube
  </code></pre>
  
  <p>the request 404's.</p>
  
  <p>So my question is, why does the mod_rewrite proxy not work the same way as the ProxyPass version, in regard to both http and https requests?  My two examples above should be functionally equivalent based on my understanding, but that does not seem to be the case.  What am I missing?  I haven't been able to track down any documentation that would explain this.  Thanks!</p>