本文介绍了在IIS反向代理后面为HTTPS设置UpSource〜TypeError:无法获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用反向IIS代理在单个服务器上通过https设置UpSource,YouTrack,TeamCity和Hub.

I am trying to set up UpSource, along with YouTrack, TeamCity and Hub, over https on a single server using a reverse IIS Proxy.

情况如下:

UpSource的http版本位于 http://server.company.com:8081/upsource 并正常工作.我希望可以通过 https://server.company.com/upsource 进行访问.但是,虽然可以通过https地址访​​问UpSource,但连接会立即中断,并出现以下错误消息:

The http version of UpSource is located at http://server.company.com:8081/upsource and works fine. I want it to be accessible via https://server.company.com/upsource. However, while it is possible to access UpSource via the https address, the connection is immediately interrupted and the following error message comes up:

Backend is not available

TypeError: Failed to fetch

考虑到自 http://server.company.com:8081/upsource 正常运行.

对于我的配置,我主要按照文档,在需要修改的地方,说明我们有四个JetBrains服务在单个服务器上并且在同一个IIS反向代理上运行.

As for my configuration, I set it up mostly following the steps as outlined in the documentation, making amends where needed to account for the fact that we have four JetBrains services running on a single server and over the same IIS Reverse Proxy.

IIS代理的当前web.config内容如下:

The current web.config for the IIS Proxy reads as follows:

<?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 Hub" stopProcessing="true">
                    <match url="^hub(.*)" />
                    <action type="Rewrite" url="http://server.company.com:8082/hub{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
                        <set name="HTTP_X_FORWARDED_SCHEMA" value="https" />
                        <set name="HTTP_X_FORWARDED_PROTO" value="https" />
                    </serverVariables>
                </rule>
                <rule name="Reverse Proxy to YouTrack" stopProcessing="true">
                    <match url="^youtrack(.*)" />
                    <action type="Rewrite" url="http://server.company.com:8080/youtrack{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
                        <set name="HTTP_X_FORWARDED_SCHEMA" value="https" />
                        <set name="HTTP_X_FORWARDED_PROTO" value="https" />
                    </serverVariables>
                </rule>
                <rule name="Reverse Proxy to UpSource" stopProcessing="true">
                    <match url="^upsource(.*)" />
                    <action type="Rewrite" url="http://server.company.com:8081/upsource{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
                        <set name="HTTP_X_FORWARDED_SCHEMA" value="https" />
                        <set name="HTTP_X_FORWARDED_PROTO" value="https" />
                    </serverVariables>
                </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>
        <security>
            <requestFiltering>
                <requestLimits maxUrl="6144" maxQueryString="4096" />
            </requestFiltering>
        </security>
    </system.webServer>
</configuration>

正如我所提到的,这对于TeamCity和Hub来说已经可以正常工作了.但是,对于UpSource,似乎仍然缺少某些内容,这很可能与"TypeError:无法获取"有关.我尝试过查找,但是到目前为止找不到任何有用的信息.

As I mentioned, this already works fine for TeamCity and Hub. However, for UpSource, there seems to be something still missing, which is likely related to the "TypeError: Failed to fetch". I've tried looking that up, but could not find any helpful information thus far .

如果有人对如何解决这个问题有任何想法,我很乐意在此方面获得更多的投入

If anyone has any ideas how to resolve this, I'd be more than happy to get additional input on this

推荐答案

好的,所以我想出了办法:

Okay, so I figured out how to do this:

上面的web.config配置实际上是正确的.但是,还需要另外按照正确的顺序执行以下步骤:

The above configuration of the web.config is actually correct. However, the following steps need to be performed in addition, and in the correct order:

注意:所有以hub.bat开头的命令都必须在[Hub Installation Directory]\bin中的hub.bat文件上执行,所有以upsource.bat开头的命令都必须在[UpSource Installation Directory]\bin中的upsource.bat文件上执行. /p>

NOTE: All commands beginning with hub.bat need to be performed on the hub.bat file in [Hub Installation Directory]\bin and all commands beginning with upsource.bat need to be performed on the upsource.bat file in [UpSource Installation Directory]\bin.

upsource.bat stop
hub.bat stop

hub.bat configure --listen-port 8082 --base-url https://server.company.com/hub
upsource.bat configure --listen-port 8081 --base-url=https://server.company.com/upsource --hub-url=https://server.company.com/hub/hub

hub.bat start
upsource.bat start --J-Dbundle.websocket.compression.enabled=false

注意:我不知道为什么,但是Hub会在其基址之后附加一个额外的/hub,这就是为什么UpSource的hub-url设置以/hub/hub结尾的原因.

NOTE: I don't know why, but Hub appends an extra /hub after its base address, that's why the hub-url setting for UpSource ends with /hub/hub.

此后,我要做的就是将重定向URL添加到集线器>设置>服务> UpSource中允许的UpSource重定向URL列表中,现在它可以正常工作了.

After that, all I needed to do was add the redirection URL to the list of allowed redirection URLs for UpSource in Hub > Settings > Services > UpSource, and now it works perfectly.

好吧,几乎完美.每当服务器重新启动时,我都需要手动重新启动UpSource,因为我还没有找到使用--J-Dbundle.websocket.compression.enabled=false参数将上游资源注册为服务的方法,但是除此之外,一切正常.

Well, almost perfectly. Whenever the server gets restarted I need to manually restart UpSource since I've not yet figured out a way to register upsource as a service with the --J-Dbundle.websocket.compression.enabled=false parameter, but apart from that, everything works perfectly.

这篇关于在IIS反向代理后面为HTTPS设置UpSource〜TypeError:无法获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:03