Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Equivalent of "proxy_set_header X-Forwarded-Proto https;"

What is the IIS equivalent of this configuration in NGINX?

proxy_set_header X-Forwarded-Proto https;

I am running JetBrains YouTrack on Windows server, using IIS as a terminating SSL proxy, and get this error when trying to log in:

HTTP ERROR 405

Problem accessing /hub/auth/login. Reason:

    HTTP method POST is not supported by this URL
Powered by Jetty://

My web.config looks like this:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Reverse Proxy" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="(.*)" />
          <!-- Redirect all requests to non-HTTPS site. -->
          <action type="Rewrite" url="http://my.youtrack.site/{R:1}" logRewrittenUrl="true" />
        </rule>
      </rules>
    </rewrite>
    <handlers>
      <clear />
      <!-- No other handlers required. Must clear them otherwise ASP.NET might try to intercept *.svc paths etc. -->
      <add name="Rewrite" path="*" verb="*" modules="RewriteModule" resourceType="Unspecified" />
    </handlers>
  </system.webServer>
</configuration>

I am trying to follow the solution from this source: https://confluence.jetbrains.com/display/YTD65/Linux.+JAR+in+Nginx+Web+Server, but for IIS

like image 613
invertigo Avatar asked Jan 08 '16 15:01

invertigo


1 Answers

Resolved after finding https://confluence.jetbrains.com/display/YTD65/Configuring+Proxy#ConfiguringProxy-IISreverseproxy

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Reverse Proxy" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="(.*)" />
                    <!-- Redirect all requests to non-HTTPS site. -->
                    <action type="Rewrite" url="http://my.youtrack.site/{R:1}" logRewrittenUrl="true" />
                    <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>
            </rules>
            <allowedServerVariables>
                <add name="HTTP_X_FORWARDED_HOST" />
                <add name="HTTP_X_FORWARDED_SCHEMA" />
                <add name="HTTP_X_FORWARDED_PROTO" />
            </allowedServerVariables>
        </rewrite>
        <handlers>
            <clear />
            <!-- No other handlers required. Must clear them otherwise ASP.NET might try to intercept *.svc paths etc. -->
            <add name="Rewrite" path="*" verb="*" modules="RewriteModule" resourceType="Unspecified" />
        </handlers>
    </system.webServer>
</configuration>
like image 139
invertigo Avatar answered Oct 16 '22 10:10

invertigo