Apache的IIS反向代理

Apache的IIS反向代理,iis,reverse-proxy,Iis,Reverse Proxy,我要花点时间让它工作。我已按照以下网址中的说明进行操作: 作为一个简单的测试,我尝试将媒体目录中的任何内容(CSS、图像等)的请求代理到单独主机上的同一目录。以下是配置: <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="^(media/.*)" />

我要花点时间让它工作。我已按照以下网址中的说明进行操作:

作为一个简单的测试,我尝试将媒体目录中的任何内容(CSS、图像等)的请求代理到单独主机上的同一目录。以下是配置:

<rewrite>
    <rules>
       <rule name="ReverseProxyInboundRule1" stopProcessing="true">
            <match url="^(media/.*)" />
            <conditions>
                 <add input="{CACHE_URL}" pattern="^(https?)://" />
             </conditions>
             <action type="Rewrite" url="{C:1}://mystatichost/{R:1}" />
        </rule>
     </rules>
 </rewrite>

但我一直收到一个404错误的图像请求。文件
/media/img/homepage.jpg
肯定存在于
mystatichost
上。我遗漏了什么/误解了什么?

我觉得你的正则表达式有点奇怪

您应该使用
,而不是
。否则,您的匹配只从URL字符串的开头开始,这永远不会起作用,因为它总是以
http
开头

因此,简而言之,请尝试以下方法:

<rewrite>
  <rules>
   <rule name="ReverseProxyInboundRule1" stopProcessing="true">
        <match url="(media/.*)" />
        <conditions>
             <add input="{CACHE_URL}" pattern="^(https?)://" />
         </conditions>
         <action type="Rewrite" url="{C:1}://mystatichost/{R:1}" />
    </rule>
  </rules>
</rewrite>

如果这不起作用,那么您是否需要HTTPS来满足对mystatichost的所有请求

也许您可以删除
部分,然后设置


祝你好运

我无法使用这种技术使反向代理工作。你做过吗?URL重定向有效,但不能重写/反向代理。
<rewrite>
  <rules>
   <rule name="ReverseProxyInboundRule1" stopProcessing="true">
        <match url="(media/.*)" />
        <conditions>
             <add input="{CACHE_URL}" pattern="^(https?)://" />
         </conditions>
         <action type="Rewrite" url="{C:1}://mystatichost/{R:1}" />
    </rule>
  </rules>
</rewrite>