title: Apache 2.4 redirect https to another port
body: <p>I'm a rookie, but I've struggled with this for some time and I am definitely doing something wrong.</p>
  
  <p>We use Apache 2.4 as the front of our internal web pages.</p>
  
  <p>When I try to forward a request to a port other than 80, it goes crazy and is redirected several times
  <a href="http://demos.company.com/demos.company.com/demos.company.com/demos.company.com/demos.company.com/demos.company.com/demos.company.com/[...]/demos.company.com/WebApplicationFail" rel="nofollow noreferrer">http://demos.company.com/demos.company.com/demos.company.com/demos.company.com/demos.company.com/demos.company.com/demos.company.com/[...]/demos.company.com/WebApplicationFail</a></p>
  
  <p>httpd.conf:</p>
  
  <pre><code>LoadModule proxy_module modules/mod_proxy.so
  LoadModule proxy_http_module modules/mod_proxy_http.so
  LoadModule rewrite_module modules/mod_rewrite.so
  
  &lt;VirtualHost *:80&gt;
      RewriteEngine on
      RewriteCond %{HTTPS} !on
      RewriteRule ^(.*) %{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:443&gt;
      SSLEngine on
      SSLCertificateFile "C:/Program Files/Apache24/conf/ssl/company.crt"
      SSLCertificateKeyFile "C:/Program Files/Apache24/conf/ssl/company.key"
      SSLCertificateChainFile "C:/Program Files/Apache24/conf/ssl/CA.pem"
  
      # Proxy configuration
      ProxyPreserveHost On
      ProxyRequests Off
      ServerName demos.company.com
  
      ProxyPass /WebApplicationOK http://10.0.0.160/WebApplicationOK
      ProxyPassReverse /WebApplicationOK http://10.0.0.160/WebApplicationOK
      ProxyPass /WebApplicationFailRoute http://10.0.0.125:8000/WebApplicationFail
      ProxyPassReverse /WebApplicationFailRoute http://10.0.0.125:8000/WebApplicationFail
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>We need to maintain the redirection of every http request to https.</p>
  
  <p>If possible, we need that the Internet address "<a href="https://demos.company.com/ThisContext" rel="nofollow noreferrer">https://demos.company.com/ThisContext</a>" show the intranet web "<a href="http://10.0.0.125:8000/OtherContext" rel="nofollow noreferrer">http://10.0.0.125:8000/OtherContext</a>".</p>
  
  <p>Thanks in advance.</p>