ssl - 尝试通过 IIS 反向代理通过 https 访问 UpSource 返回一个空页面

标签 ssl iis https reverse-proxy upsource

我目前正在尝试使用 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/

相关文章:

c# - 无法远程返回自定义 HTTP 错误详细信息

ssl - 启用 SSL 需要的不仅仅是打开它吗?

ssl - 如何让我的 Google Cloud Load Balancer 工作?

perl IO::Socket::SSL SSL 连接尝试失败

linux - Apache 2.4 中的 SSL 证书错误

asp.net - 从 HTTP 重定向到 HTTPS - IIS 7.5

asp.net - (405) 不允许的方法。 WCF网络服务

php - 将上传文件移动到 IIS 中的另一台服务器的权限被拒绝

java - 未找到证书路径的 SSLHandshakeException 信任 anchor Android HTTPS

mobile - 将 SSL 证书添加到 Adob​​e Air 移动应用程序