Apache ProxyPass:安装 SSL 后页面未自动刷新

Apache ProxyPass: Page not refreshing automatically after SSL installed

昨天我配置了一个 Apache 反向代理以在端口 8080 上的 docker 运行 中为 Ansible AWX 获取 SSL 证书。带有代理的 Apache 在 docker 前面侦听端口 80。 一切正常,但现在如果我开始工作,网站不会自行刷新。我必须手动完成才能获得结果。如果我通过浏览服务器 ip 来做,它工作正常。

这是我的代码 default.conf:

SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
<VirtualHost *:443>
ServerName example.com
ServerAdmin mail@example.com

ProxyPass / http://IP:8080/
ProxyPassReverse / http://IP:8080/
ProxyPreserveHost On
ProxyPassReverseCookiePath / /

<Proxy *>
    Order deny,allow
    Allow from all
    Allow from localhost
</Proxy>


SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>


<VirtualHost *:80>

ServerName example.com
ServerAdmin webmaster@localhost


Redirect permanent / https://example.com

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

ProxyPass / ws://IP:8080/

RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} 
[END,NE,R=permanent]
</VirtualHost>

非常感谢! :)

谢谢你的提示,Dusan。解决了。​​

这是一个 websocket 错误,我通过将这些代码行添加到我的 default.conf.

来修复它
    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:8080%{REQUEST_URI} [P]