I am trying to set up UpSource, along with YouTrack, TeamCity and Hub, over https on a single server using a reverse IIS Proxy.
The situation is as follows:
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
I find this error to be weird and confusing, considering that the backend appears to be available and running since http://server.company.com:8081/upsource works perfectly.
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.
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>
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:
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:
NOTE: All commands beginning with
hub.batneed to be performed on thehub.batfile in[Hub Installation Directory]\binand all commands beginning withupsource.batneed to be performed on theupsource.batfile in[UpSource Installation Directory]\bin.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.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.
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=falseparameter, but apart from that, everything works perfectly.