我设法在我的服务器上设置了带有 Apache 前端的 Gitlab。由于默认 SSL 端口已被占用,我添加了一个
Listen 444
到 Apache 端口和 VirtualHost 之类的
<VirtualHost *:444>
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 !
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:8081
ProxyPassReverse https://my.server.de:444/
</Proxy>
# needed for downloading attachments
DocumentRoot /home/git/gitlab/public
<Location />
Order deny,allow
Allow from all
</Location>
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>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
</VirtualHost>
目标是转发到本地独角兽(这是使用Gitlab的标准场景)。
打电话时
https:/my.server.de:444
我重定向到 /users/sign_in(如预期的那样),但在 HTTP 标头位置设置了“http”方案。我可以成功得到
https:/my.server.de:444/users/sign_in
手动,但在每个帖子上,重定向位置都会再次错过正确的方案。知道发生了什么吗?ProxyPassReverse 不应该处理这个吗?