昨天,我配置了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 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>
非常感谢! :)
答案 0 :(得分:1)
谢谢你的提示,杜珊。解决了。
这是一个websocket错误,我通过将这些代码行添加到default.conf中进行了修复。
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://localhost:8080%{REQUEST_URI} [P]