IIS等效于" proxy_set_header X-Forwarded-Proto https;"

时间:2016-01-08 15:43:20

标签: iis nginx youtrack

NGINX中此配置的IIS等价物是什么?

proxy_set_header X-Forwarded-Proto https;

我在Windows服务器上运行JetBrains YouTrack,使用IIS作为终止SSL代理,并在尝试登录时出现此错误:

HTTP ERROR 405

Problem accessing /hub/auth/login. Reason:

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

我的web.config看起来像这样:

<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>

我正在尝试按照此来源的解决方案:https://confluence.jetbrains.com/display/YTD65/Linux.+JAR+in+Nginx+Web+Server,但对于IIS

1 个答案:

答案 0 :(得分:6)

找到https://labs.activecollab.com/nightly-activecollab-api/v1/authentication.html

后解决
<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>