设定:
Nginx作为反向代理,终止https
本地主机上的Apache:8080将邮件应用程序(admin gui)发送给Nginx
当我在浏览器中输入确切的URL时 https://lists.staging.xxx.de/mailman/它完美无缺。
当我输入https://lists.staging.xxx.de/mailman(没有尾随斜线)或甚至只有https://lists.staging.xxx.de/时,Apache RedirectMatch会启动,并通过标题位置信息发送回正确的网址 - 但是方案不正确< / strong>,即“位置:http://lists.staging.xxx.de/mailman/”
当我执行curl -L -v -s -o /dev/null localhost:8080
时,我会回来:Location: http://localhost:8080/mailman/
。
所以我得出结论: Nginx正确地重写了主机,但没有重写方案。
所以,要么我必须改变Nginx的配置,所以它重写头(即方案),或者我必须让Apache知道,即使https被终止 - 头位置语句应该包含https。
感谢任何帮助!
Nginx配置:
server {
listen xxx:443;
server_name lists.staging.xxx.de;
if ($host != lists.staging.xxx.de) {
rewrite (.*) https://lists.staging.xxx.de$1 permanent;
}
ssl on;
ssl_certificate /srv/s-bliss/deployment/work/nginxmailman/lists.staging.xxx.de.crt;
ssl_certificate_key /srv/s-bliss/deployment/work/nginxmailman/lists.staging.xxx.de.key;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
}
Apache配置:
Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
ServerName lists.staging.xxx.de
Alias /mailman/icons /usr/lib/mailman/icons
<Directory "/usr/lib/mailman/icons/">
AllowOverride None
Require all granted
</Directory>
Alias /mailman/archives /var/lib/mailman/archives/public
<Directory "/var/lib/mailman/archives/public/">
AllowOverride None
Options ExecCGI FollowSymLinks
AddDefaultCharset off
Require all granted
</Directory>
RedirectMatch ^/$ /mailman/
RedirectMatch ^/mailman$ /mailman/
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/mailman/(archives|icons)
RewriteRule ^/mailman/(.*) /usr/lib/mailman/cgi-bin/$1 [H=cgi-script]
<Directory "/usr/lib/mailman/cgi-bin/">
AllowOverride None
Options ExecCGI
DirectoryIndex listinfo
Require all granted
</Directory>
答案 0 :(得分:0)
我们的提供商提出了以下解决方案:
http://lists.staging.xxx.de/mailman/ https://lists.staging.xxx.de/mailman/;
有效!
更新: 标题现在正确传递,但有效负载(正文)仍包含指向http版本的链接。