【发布时间】:2019-05-14 16:14:33
【问题描述】:
我正在尝试使用 Azure 网站设置反向代理,大致遵循 this guide 说明如何在此类网站上修改 ApplicationHost.config - 但它对我不起作用。
我有这个 applicationHost.xdt:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="false" reverseRewriteHostInResponseHeaders="false" />
<rewrite>
<allowedServerVariables>
<add name="HTTP_X_ORIGINAL_HOST" xdt:Transform="InsertIfMissing" />
<add name="HTTP_X_UNPROXIED_URL" xdt:Transform="InsertIfMissing" />
<add name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" />
<add name="HTTP_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" />
</allowedServerVariables>
</rewrite>
</system.webServer>
</configuration>
我把它放在我的网络应用程序的site 目录中。
转换似乎已被执行(来自转换日志):
2017-09-06T12:12:20 StartSection Executing InsertIfMissing (transform line 8, 50)
2017-09-06T12:12:20 on /configuration/system.webServer/rewrite/allowedServerVariables/add
2017-09-06T12:12:20 Applying to 'allowedServerVariables' element (no source line info)
2017-09-06T12:12:20 EndSection Done executing InsertIfMissing
我确实有四个这样的积木。
通过重写设置标题我仍然得到 500 秒。详细的错误消息包含以下内容:
<h3>HTTP Error 500.50 - URL Rewrite Module Error.</h3>
<h4>The server variable "HTTP_X_UNPROXIED_URL" is not allowed to be set. Add the server variable name to the allowed server variable list.</h4>
目前不知道该怎么做。有什么想法吗?
【问题讨论】:
-
请以github.com/projectkudu/kudu/wiki/…开头,并确定您的问题是在第二个还是第三个桶中。
-
我已经使用该资源了 - 谢谢。我不知道如何查看生成的
applicationhost.config。
标签: azure azure-web-app-service