使用 IIS7 应用程序请求路由修改标头 [英] Modifying headers with IIS7 Application Request Routing

查看:18
本文介绍了使用 IIS7 应用程序请求路由修改标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Tomcat 前使用 IIS7 应用程序请求路由来替代 ISAPI 重定向.基本的反向代理功能运行良好,但我在最终请求标头中没有足够的信息.我的应用程序存在于多个子域中:customerone.ourservice.com、customertwo.ourservice.com 等.每个子域运行相同的应用程序,但具有不同的品牌图形.

I'm using IIS7 Application Request Routing in front of Tomcat as a replacement for ISAPI redirection. The basic reverse proxy function is working well, but I don't have enough information in the final request headers. My application exists on several subdomains: customerone.ourservice.com, customertwo.ourservice.com, etc. Each subdomain runs the same application, but with different branding graphics.

应用程序当前查看 Host 标头以判断要显示哪个品牌.当我使用 IIS7 反向代理时,该信息丢失了.我的标题现在是:

The application currently looks at the Host header to tell which branding to display. When I use the IIS7 reverse proxy, that information is lost. My headers are now:

accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
accept-charset = ISO-8859-1,utf-8;q=0.7,*;q=0.7
accept-encoding = gzip,deflate
accept-language = en-gb,en;q=0.7,en-us;q=0.3
cookie = JSESSIONID=......
host = 127.0.0.1:8080
max-forwards = 10
user-agent = Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.15) Gecko/2009102815 Ubuntu/9.04 (jaunty) Firefox/3.0.15
x-original-url = /
x-forwarded-for = [iis7ip]:47567
x-arr-log-id = affbf81c-a5cf-4212-a43b-901cd9adcee6
connection = Keep-Alive

有什么办法可以将原始的 Host 标头插入反向代理传递的请求标头中吗?

Is there any way I can insert the original Host header into the request headers passed on by the reverse proxy?

推荐答案

Application Request Routing 有一个保留原始主机头的选项:preserveHostHeader.此选项默认为 false.您可以通过以下方式启用它:

Application Request Routing has an option to preserve the original host header: preserveHostHeader. This option is by default false. You can enable it with:

"C:WindowsSystem32inetsrvappcmd.exe" set config -section:system.webServer/proxy /preserveHostHeader:"True" /commit:apphost

这篇关于使用 IIS7 应用程序请求路由修改标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆