Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure web apps无法将代理反向到Wordpress站点_Wordpress_Azure_Reverse Proxy - Fatal编程技术网

Azure web apps无法将代理反向到Wordpress站点

Azure web apps无法将代理反向到Wordpress站点,wordpress,azure,reverse-proxy,Wordpress,Azure,Reverse Proxy,谁能告诉我如何在Azure网站上设置合理标准的反向代理协议 我希望(Azure托管)www.site.co/blog在blog.site.co上显示(非Azure托管)wordpress站点,这样用户就不会看到Url更改 ApplicationHost.xdt已上载 <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <system.webServer>

谁能告诉我如何在Azure网站上设置合理标准的反向代理协议

我希望(Azure托管)www.site.co/blog在blog.site.co上显示(非Azure托管)wordpress站点,这样用户就不会看到Url更改

ApplicationHost.xdt已上载

 <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_USE_HTTPS" xdt:Transform="InsertIfMissing" />
                <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> 

Web.Config包括:

<rule name="Proxy" stopProcessing="true">
      <match url="^blog/?(.*)" />
      <action type="Rewrite" url="https://blog.site.co/{R:1}" />
      <serverVariables>
        <set name="HTTP_X_UNPROXIED_URL" value="https://blog.site.co/{R:1}" />
        <set name="HTTP_X_USE_HTTPS" value="{HTTPS}"/>
      </serverVariables>
    </rule>

我得到以下错误:

“HTTP错误500.50-URL重写模块错误。
不允许设置服务器变量“HTTP\u X\u UNPROXIED\u URL”。请将服务器变量名称添加到允许的服务器变量列表中。

当使用
xdt:Transform=“InsertIfMissing”
设置具有相同标记名(
)的同一父级的多个子元素时,还需要使用
xdt:Locator=“Match(name)”
,否则,XDT系统将只插入第一个
元素

因此,在您的情况下,XDT系统只插入
,而不会复制其他元素,因为已经存在
元素

(如果源转换文档指定了多个
Insert
InsertIfMissing
元素,而没有
XDT:Locator
,我认为应该改进XDT,并抛出一个错误)

因此,将您的
applicationHost.xdt
更改为:

<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_USE_HTTPS"                xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_X_ORIGINAL_HOST"            xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_X_UNPROXIED_URL"            xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_ACCEPT_ENCODING"            xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
            </allowedServerVariables>
        </rewrite>
    </system.webServer>
</configuration> 

使用
xdt:Transform=“InsertIfMissing”
设置具有相同标记名的同一父元素的多个子元素(
)时,还需要使用
xdt:Locator=“Match(name)”
,否则xdt系统将只插入第一个
元素

因此,在您的情况下,XDT系统只插入
,而不会复制其他元素,因为已经存在
元素

(如果源转换文档指定了多个
Insert
InsertIfMissing
元素,而没有
XDT:Locator
,我认为应该改进XDT,并抛出一个错误)

因此,将您的
applicationHost.xdt
更改为:

<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_USE_HTTPS"                xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_X_ORIGINAL_HOST"            xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_X_UNPROXIED_URL"            xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                <add name="HTTP_ACCEPT_ENCODING"            xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
            </allowedServerVariables>
        </rewrite>
    </system.webServer>
</configuration> 


更新xdt文件后是否重新启动了webapp?是。无更改。从匹配项中删除“?”可以改进/blog/的结果,重定向也可以工作/但是博客失败,没有任何内容被屏蔽。您将
ApplicationHost.xdt
上传到哪里了?它必须位于
d:\home\site\applicationHost.xdt
目录下,而不是位于
d:\home\site\wwwroot
目录下。我尝试了这两个位置。localhost或azure测试速度没有更改更新xdt文件后是否重新启动webapp?是。无更改。从匹配项中删除“?”可以改进/blog/的结果,重定向也可以工作/但是博客失败,没有任何内容被屏蔽。您将
ApplicationHost.xdt
上传到哪里了?它必须位于
d:\home\site\applicationHost.xdt
目录下,而不是位于
d:\home\site\wwwroot
目录下。我尝试了这两个位置。本地主机或azure测试插槽上没有更改