简体   繁体   English

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

[英]Apache ProxyPass: Page not refreshing automatically after SSL installed

yesterday I configured an Apache Reverse Proxy to get a SSL certificate for Ansible AWX inside a docker running on port 8080. Apache with the proxy is in front of the docker listening on port 80. Everything's working fine but now if I'm starting a job the site is not refreshing itself.昨天我配置了一个 Apache 反向代理,以在端口 8080 上运行的 docker 中获取 Ansible AWX 的 SSL 证书。带有代理的 Apache 位于侦听端口 80 的 docker 前面。一切正常,但现在如果我开始工作该网站本身没有刷新。 I have to do it manually to get results.我必须手动完成才能获得结果。 If I'm doing it through browsing server ip it's working fine.如果我是通过浏览服务器 ip 进行的,则它工作正常。

This is the code of my default.conf:这是我的 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>

Many thanks in advance!提前谢谢了! :) :)

Thanks for the hint, Dusan.谢谢你的提示,杜桑。 It's solved.解决了。

It was a websocket error and I fixed it with adding those lines of code into my default.conf.这是一个 websocket 错误,我通过将这些代码行添加到我的 default.conf 中来修复它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM