Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.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
IIS反向代理到虚拟专用ip_Iis_Docker_Reverse Proxy_Boot2docker - Fatal编程技术网

IIS反向代理到虚拟专用ip

IIS反向代理到虚拟专用ip,iis,docker,reverse-proxy,boot2docker,Iis,Docker,Reverse Proxy,Boot2docker,我正在尝试使用IIS 7.5将特定端口上的代理传入请求反向到绑定到VirtualBox vm专用ip上的端口的docker容器,以便我的LAN上的外部主机可以访问我的应用程序 请假设如下: 我在Windows7中运行docker和b2d映像 docker-machine接收一个虚拟专用ip,例如只能由主机解析的192.168.99.100 我在rabbitmq:3-management映像上构建了一个容器,管理门户绑定到我的虚拟机的默认网关上的端口32771 我希望通过网络将请求发送到http

我正在尝试使用IIS 7.5将特定端口上的代理传入请求反向到绑定到VirtualBox vm专用ip上的端口的docker容器,以便我的LAN上的外部主机可以访问我的应用程序

请假设如下:

  • 我在Windows7中运行docker和b2d映像
  • docker-machine
    接收一个虚拟专用ip,例如只能由主机解析的
    192.168.99.100
  • 我在
    rabbitmq:3-management
    映像上构建了一个容器,管理门户绑定到我的虚拟机的默认网关上的端口32771
  • 我希望通过网络将请求发送到
    http://mymachine:32771
    从我的虚拟机通过IIS 7.5为32771端口反向代理,并显示RabbitMQ管理门户,如果我导航到http:192.168.99.100:32771,该门户将为我私密显示
有人能给我展示一下实现这一点所需的入站和出站重写规则的示例吗

这是我迄今为止根据在IIS反向代理中找到的稀疏示例尝试的方法,我将其放在我的
inetpub/wwwroot
的web.config中,但规则不适用(即使在
iisreset
之后)

请注意,在我下面的配置中,我正在查找包含“rabbit/”的任何请求,而不是特定的端口,但它也不是代理

编辑:[注意]我也尝试过
http://rabbit.(我的机器名?(/+?*))$|(.*)/rabbit(/+?*))$
捕获通过
rabbit.
子路径或
/rabbit
路径进入我的机器的任何内容。我验证了捕获规则,但RP仍然没有代理



在过去,我只会支持Apache并引入
mod_proxy
,因为它的简单性和文档,但我更想知道如何在IIS中实现这一点。

在IIS中使用URL重写感谢您的建议,但该指南已经被遵循,其指导不足;跟着它到了T,我只得到404.2s,没有FRT日志。“@RicardoC…这将反向代理整个主机,这不是目标……或者你是建议作为一种测试,以查看行为是否发生变化?这一切似乎违反直觉,我知道,我也与之斗争过。尝试一下。(当然,除非我完全误解了你的意图)。“匹配”是你的机器(代理)接收的请求,并且”“重写”是实际的web应用程序(源代码)执行此工作。
<rewrite>
    <rules>
        <rule name="RP requests for Rabbit to virtual private IP" stopProcessing="false">
            <match url="(.*)rabbit/(.*)" />
            <conditions>
                <add input="{CACHE_URL}" pattern="^(https?)://" />
            </conditions>
            <action type="Rewrite" url="{C:1}://192.168.99.100:32771/{R:1}" />
            <serverVariables>
                <set name="HTTP_ACCEPT_ENCODING" value="" />
            </serverVariables>
        </rule>
    </rules>
    <outboundRules>
        <rule name="RP requests from Rabbit to outbound" preCondition="ResponseIsHtml">
            <match  filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script"
                pattern="^http(s)?://192.168.99.100:32771/(.*)" />
            <action type="Rewrite" value="/rabbit/{R:1}" />
        </rule>
        <preConditions>
            <preCondition name="ResponseIsHtml">
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
            </preCondition>
        </preConditions>
    </outboundRules>
</rewrite>