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

问题描述 投票:1回答:1

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

这是我的default.conf的代码:

SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
<VirtualHost *:443>
ServerName example.com
ServerAdmin [email protected]

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>

提前谢谢了! :)

apache ssl ansible certbot
1个回答
1
投票

感谢Dusan的暗示。它已经解决了。

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

    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:8080%{REQUEST_URI} [P]
© www.soinside.com 2019 - 2024. All rights reserved.