我目前正在尝试使用 IIS 反向代理设置各种 Jetbrains 服务以通过 https 使用。完整的预期设置应该看起来像这样:
TeamCity: https://server.company.com -> http://server.company.com
YouTrack: https://server.company.com/youtrack/ -> http://server.company.com:1234/issues/
Hub: https://server.company.com/hub/ -> http://server.company.com:5678/hub/
UpSource: https://server.company.com/upsource/ -> http://server.company.com:9876
我已经通过使用以下配置为 TeamCity 和 YouTrack 实现了一些困难:
在 IIS 中,我有一个用作重定向的 TeamCity 网站。该站点的 web.config 当前如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Reverse Proxy to TeamCity" stopProcessing="true">
<match url="^teamcity/(.*)" />
<action type="Rewrite" url="http://server.company.com/{R:1}" />
</rule>
<rule name="Reverse Proxy to YouTrack" stopProcessing="true">
<match url="^youtrack/(.*)" />
<action type="Rewrite" url="http://server.company.com:8080/issues/{R:1}" />
</rule>
<rule name="Reverse Proxy to Hub" stopProcessing="true">
<match url="^hub/(.*)" />
<action type="Rewrite" url="http://server.company.com:8082/hub/{R:1}" />
</rule>
<rule name="Reverse Proxy to UpSource" stopProcessing="true">
<match url="^upsource/(.*)" />
<action type="Rewrite" url="http://server.company.com:8081/{R:1}" />
</rule>
<rule name="Reverse Proxy to Collaboration General" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://server.company.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
此外,我还按照 documentation 中的说明配置了以下服务器变量:
HTTP_X_FORWARDED_HOST
HTTP_X_FORWARDED_SCHEME
HTTP_X_FORWARDED_PROTO
但是,当尝试通过 https://server.company.com/upsource/ 访问 UpSource 时,我得到的只是一个标题为“Upsource”的空白页面。没有错误信息。甚至不是最喜欢的图标。通过 http://server.company.com:8081/ 访问 UpSource不过仍然可以正常工作。
我也已经尝试运行以下命令链:
upsource.bat stop
upsource.bat configure --listen-port 8081 --base-url https://server.company.com:443/upsource/
upsource.bat start --J-Dbundle.websocket.compression.enabled=false
但是,这确实导致问题变为:
HTTP ERROR: 404
Problem accessing /bundle/starting. Reason:
Not Found
Powered by Jetty:// 9.3.20.v20170531
如何设置 UpSource 以像 TeamCity 和 Hub 已经在做的那样工作?
如有任何帮助,我们将不胜感激。
最佳答案
在 YouTrack 支持人员帮助解决相关 YouTrack 错误的帮助下,我能够找出此问题背后的原因。
原因是:当使用重定向路径通过 https 访问 UpSource 时,http 和 https 变体中的路径需要相同。
简而言之,这是行不通的:
https://server.company.com/upsource -> http://server.company.com:9876
但这会:
https://server.company.com/upsource -> http://server.company.com:9876/upsource
我通过在 [InstDir]/bin 中的 upsource.bat 上运行以下配置命令来让它工作:
upsource.bat configure --listen-port 9876 --base-url http://server.company.com:9876/upsource
现在我至少可以通过 https 连接并登录 UpSource。还有一个问题,但是因为它与这个问题的主题无关,所以我会为它创建一个单独的问题。
关于ssl - 尝试通过 IIS 反向代理通过 https 访问 UpSource 返回一个空页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49570508/