【发布时间】:2019-09-30 16:47:09
【问题描述】:
使用 Azure Server Core 2019 VM,我设置了许多 Docker 容器,并将 ISS/ARR 3.0 作为反向代理。
当我访问主机 url:“http://[hostname]/deploy”时,我希望 RP 重定向到 http://[docker ip]:81
81 是运行“部署”的独立内部 docker 容器的公开端口。仅供参考:这被映射到主机端口 1322...通过外部浏览器访问主机名:1322 工作正常。
(我也尝试过对 [hostname]:1322 和 [docker ip]:1322 使用重写规则)
无论我做什么,我总是得到 404(未找到)
我不知道为什么。 Azure 本身有什么东西把这搞砸了吗?我在 Windows 中似乎对 docker 可用的唯一网络是 NAT(通过 docker network ls)。我通过“docker inspect [container]”获得了目标 docker 容器的正确 IP 地址,但我认为这是暴露给主机的 IP 地址,而不是主机上运行的其他容器可以看到的 IP 地址。
我如何知道其他正在运行的 docker 容器可用于 ARR 规则的内部 docker IP 是什么(或者是否有其他方法可以设置它以便动态了解规则?)
我的 ARR web.config 是:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="deploy" stopProcessing="true">
<match url="^(.*)/deploy" />
<action type="Rewrite" url="http://172.23.60.148:81" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我的反向代理 docker 文件是:
FROM mcr.microsoft.com/windows/servercore/iis
# Download and install the required URL rewrite and Application Request Routing modules. Clean up after!
ADD http://go.microsoft.com/fwlink/?LinkID=615137 /install/rewrite_amd64.msi
ADD http://go.microsoft.com/fwlink/?LinkID=615136 /install/ARRv3_setup_amd64_en-us.msi
RUN msiexec.exe /i C:\install\rewrite_amd64.msi /qn /log C:\ms_install.log & \
msiexec.exe /i C:\install\ARRv3_setup_amd64_en-us.msi /qn /log C:\arr_install.log & \
rd /s /q c:\install
# Enable proxy feature for IIS. Allows us to act as a reverse proxy
RUN .\Windows\System32\inetsrv\appcmd.exe set CONFIG -section:system.webServer/proxy /enabled:"True" /commit:apphost
# The web config should contain our routing to other containers
ADD ./web.config /inetpub/wwwroot/web.config
【问题讨论】:
-
这绝对是一个 ARR 问题。我已经安装了一个虚拟机并添加了 ARR 等,并通过 UI 创建了 ARR 规则。根据规则测试器,localhost/deploy 是匹配项,但是当它在网站中运行时,会出现 404。这是因为它试图找到localhost/deploy 而不是重写。当您查看跟踪日志时,结果是“不匹配”......
-
可以分享一下arr规则的frt结果吗?