title: HTTPS scheme lost in Apache proxy scenario upon redirect from Gitlab
body: <p>I managed to setup Gitlab with an Apache frontend on my server. As the default SSL port is already occupied i added a </p>
  
  <pre><code>Listen 444
  </code></pre>
  
  <p>to the Apache ports and a VirtualHost like</p>
  
  <pre><code>&lt;VirtualHost *:444&gt;
  
    ServerSignature Off
  
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXP:!eNULL:!aNULL:RC4+RSA:+HIGH:-MEDIUM:!LOW:-SSLv2
    SSLCertificateFile /etc/apache2/ssl/server.crt
    SSLCertificateKeyFile /etc/apache2/ssl/server.key
  
    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
  
    ProxyPreserveHost On
    ProxyPass /uploads !
    ProxyPass /error !
  
    &lt;Proxy balancer://unicornservers&gt;
      BalancerMember http://127.0.0.1:8081 
      ProxyPassReverse https://my.server.de:444/
    &lt;/Proxy&gt;
  
    # needed for downloading attachments
    DocumentRoot /home/git/gitlab/public
  
    &lt;Location /&gt;
      Order deny,allow
      Allow from all
    &lt;/Location&gt;
  
    LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %&gt;s %b" common_forwarded
    ErrorLog  /var/log/apache2/gitlab.error.log
    CustomLog /var/log/apache2/gitlab.forwarded.log common_forwarded
    CustomLog /var/log/apache2/gitlab.access.log combined env=!dontlog
    CustomLog /var/log/apache2/gitlab.log combined
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Goal is to forward to the local unicorn (this is the standard scenario using Gitlab).</p>
  
  <p>When calling</p>
  
  <pre><code>https:/my.server.de:444
  </code></pre>
  
  <p>i get a redirect to /users/sign_in (as expected), but with the "http" scheme set in the HTTP header location. I can sucessfully get  </p>
  
  <pre><code>https:/my.server.de:444/users/sign_in
  </code></pre>
  
  <p>manually, but on every post the redirect location misses the correct scheme again. Any idea what is going on? Shouldn't the ProxyPassReverse take care of this?</p>