apache - 登录 ShinyProxy 后 Apache 重定向到 http
问题描述
我已经成功设置了一个 Apache HTTPD Web 服务器和 ShinyProxy 实例,这样我就可以通过 https 访问一组闪亮的应用程序(在运行 amazon linux 的服务器上)。
当我访问
我(如预期的那样)获得了网络应用程序(闪亮的代理)提供的登录页面。现在,它被设置为使用简单的身份验证。
但是,当我登录(成功)时,我正在查看的页面会将我重定向到http://example.com。我需要它保持在 https 上,特别是因为 google auth 不允许您重定向到 http 页面。
我认为问题可能出在我的 apache 配置文件上。相关部分是
<VirtualHost *:80>
ServerName example.com
Redirect / https://www.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/
SSLEngine on
SSLProxyEngine On
SSLCertificateFile <path to crt>
SSLCertificateKeyFile <path to key>
SSLCertificateChainFile <path to bundle>
# This block is needed for the interal workings off the app
<Proxy *>
Allow from localhost
</Proxy>
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://localhost:3600/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://localhost:3600/$1 [P,L]
ProxyPass / http://localhost:3600/
ProxyPassReverse / http://localhost:3600/
ProxyRequests Off
ProxyPreserveHost On
</VirtualHost>
有人对我如何解决这个问题有任何想法吗?
解决方案
我找到了一个解决方案,所以我提供了答案,以防其他人仍然被卡住。
如果您仍然对我有这个问题,那么问题是我在闪亮的代理 application.yml 文件中包含的主页图像是通过 http 提供的,因此 apache 迫使整个网站返回 http。将默认图像交换为通过 https 提供的图像修复了问题。
此外,在最新版本的闪亮代理(2.4+)中,您需要在服务器下的应用程序 yml 中包含阻止该行。
forward-headers-strategy: native
推荐阅读
- android - dumpsys netstats 输出中 ST 和 OP 字段的含义
- javascript - 如何制作不同的菜单项下拉菜单
- java - Java 9:运行旧版 jar
- variables - 你可以在 Visual Studio Code 中保存变量吗?
- asynchronous - Python 3.6+ 中的异步 POST 在 while 循环中
- bash - Bash - 删除目录中只有一列的制表符分隔文件
- android - 使用 firebase ui 获取联系人有来自 firebase 的消息的联系人
- rust - 你能测试一个依赖的特性是否使用 `cfg!` 宏来设置吗?
- node.js - req.body(请求正文)在nodejs中使用ajax提交表单给出一个空值
- c++ - 没有任何额外数据成员的派生类的大小