【发布时间】:2016-01-20 13:44:31
【问题描述】:
我想要达到的目标:
浏览器 -> Apache (https) -> Sonarqube (http)
问题:
Sonar 的位置标头是 http://..,所以访问 https://trm.tine.no/sonar 重定向到 http://trm.tine.no/sonar
我已按照此处所述的标准反向代理基础架构的说明进行操作: http://docs.sonarqube.org/display/SONAR/Running+SonarQube+Over+HTTPS
ProxyPreserveHost On
ProxyRequests Off
..
.. SSL config goes here
..
RequestHeader set X-Forwarded-Proto "https"
#SONAR related configurations
AllowEncodedSlashes NoDecode
ProxyPass /sonar http://<my.ip>:9000/sonar disablereuse=On nocanon
ProxyPassReverse /sonar http://<my.ip>:9000/sonar
我已经通过代理 Nexus(也依赖于 X-Forwarded-Proto)验证了 X-Forwarded-Proto 标头,并且按预期工作。
curl 将 Location 标头确认为 http,而不是 https curl -I https://trm.tine.no/sonar
HTTP/1.1 302 Found
Date: Wed, 21 Oct 2015 13:49:39 GMT
Server: Apache-Coyote/1.1
Location: http://trm.tine.no/sonar/
Transfer-Encoding: chunked
想知道我可能遗漏了什么,或者这是否是一个实际的错误?
运行 Sonarqube 5.1.1
解决方案
@kraal 提出的解决方案对我们没有任何影响,但如果您将 / 附加到 URI,它就可以工作。
例如
curl -I https://trm.tine.no/sonar
HTTP/1.1 302 Found
Date: Thu, 22 Oct 2015 10:53:23 GMT
Server: Apache-Coyote/1.1
Location: http://trm.tine.no/sonar/
Transfer-Encoding: chunked
正如我们所见,Location 仍然设置为 http,但以下工作(注意末尾的 /)
curl -I https://trm.tine.no/sonar/
HTTP/1.1 302 Found
Date: Thu, 22 Oct 2015 10:53:25 GMT
Server: Apache-Coyote/1.1
Cache-Control: no-cache
Location: https://trm.tine.no/sonar/sessions/new
X-Frame-Options: SAMEORIGIN
Content-Type: text/html;charset=utf-8
Content-Length: 104
Set-Cookie: JSESSIONID=A8B19F73D93B35BCA24F019EEB848666; Path=/sonar/; HttpOnly
所以当 Sonar 重定向到 /sonar/sessions/new(登录页面)时似乎发生了一些事情,它的行为与 /sonar/ 到 /sonar 不同
将 / 附加到 URI 是一种适用于我们的解决方法。
【问题讨论】:
标签: sonarqube mod-proxy sonarqube5.1