复制 mod-IIS 中的代理行为
Replicate mod-proxy behavior in IIS
我需要一个 http 代理服务器来将来自 mydomain.com 的请求重定向到 http://localhost:8080
Apache 网络服务器使用 mod_procy 和 mod_proxy_http 执行此操作,配置如下
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot D:/tmp/iis
DirectoryIndex index.html index.php index.jsp
<Proxy *>
Order Allow,Deny
Allow from all
</Proxy>
ProxyRequests On
ProxyVia On
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
我的服务器是 windows 机器,我想使用 IIS(Internet 信息服务)代替我尝试了以下 IIS 配置:
绑定
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRuleForReports" stopProcessing="true">
<match url="(/.*)" />
<action type="Rewrite" url="http://localhost:8083/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
IIS 重写 URL 但不会像 mod_proxy 在 Apache
中那样将请求转发到另一台服务器
是否可以在 IIS 中复制 Apache 行为?在那种情况下,正确的服务器配置是什么?
如果您有有用的 Apache 代理规则,可以将其导入 IIS。 IIS 将自动生成 url 重写规则。参考这个article.
我需要一个 http 代理服务器来将来自 mydomain.com 的请求重定向到 http://localhost:8080 Apache 网络服务器使用 mod_procy 和 mod_proxy_http 执行此操作,配置如下
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot D:/tmp/iis
DirectoryIndex index.html index.php index.jsp
<Proxy *>
Order Allow,Deny
Allow from all
</Proxy>
ProxyRequests On
ProxyVia On
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
我的服务器是 windows 机器,我想使用 IIS(Internet 信息服务)代替我尝试了以下 IIS 配置:
绑定
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRuleForReports" stopProcessing="true">
<match url="(/.*)" />
<action type="Rewrite" url="http://localhost:8083/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
IIS 重写 URL 但不会像 mod_proxy 在 Apache
中那样将请求转发到另一台服务器是否可以在 IIS 中复制 Apache 行为?在那种情况下,正确的服务器配置是什么?
如果您有有用的 Apache 代理规则,可以将其导入 IIS。 IIS 将自动生成 url 重写规则。参考这个article.