Apache、mod_proxy 和反向代理运行 .net 4 的 IIS6 后端

发布于 2024-10-21 11:54:22 字数 1881 浏览 8 评论 0原文

我有一个非常奇怪的问题。我有一个 IIS6 后端服务器。 如果 IIS 上的站点配置为 .net 2.0/3/3.5,那么 apache 会做得很好。 如果站点配置为 .net 4.0,apache 会提供 400 错误请求。 我已经附加了 http 标头,我可以看到正确的 apache 和正确的 iis 服务器被命中,以及 iis 服务器上的正确站点。 如果我直接访问服务器,它在两种模式下都可以很好地工作。 它只是 apache (https) 连接到运行 .net 4.0 站点的 IIS6 (http) 的组合。

以下是一些数据包示例

失败请求

GET http://www.domain.com/ HTTP/1.1
Host: www.domain.com
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Via: 1.1 domain.com
X-Forwarded-For: [ipaddress]
X-Forwarded-Host: www.domain.com
X-Forwarded-Server: domain.com
Connection: Keep-Alive

失败响应

HTTP/1.1 400 Bad Request
Connection: close
Date: Fri, 11 Mar 2011 02:24:34 GMT
Content-Type: text/html; charset=utf-8

工作请求

GET / HTTP/1.1
Host: www.domain.com
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Connection: Keep-Alive

工作响应

HTTP/1.1 302 Found
Date: Fri, 11 Mar 2011 02:29:12 GMT
Location: /Account/Login/?ReturnUrl=%2f
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 146

这两个请求针对同一站点,一个通过代理,一个直接。我能看到的唯一有意义的事情就是每次获得的价值。一个是路径,另一个是域和路径。但正如我所提到的,我所要做的就是将 IIS6 中的网站切换为使用 2.0 运行时而不是 4.0 运行时。

有人对可能出现的问题有任何想法吗?

I have a really weird issue. I have an IIS6 backend server.
If a site on IIS is configured to .net 2.0/3/3.5 then apache does a great job.
If the site is configured to .net 4.0, apache serves up a 400 bad request.
I've attached http headers and I can see the correct apache and correct iis server is hit, and the correct site on the iis server.
If i go directly to the server it works great to in both modes.
It's just the combination of apache (https) connecting to IIS6 (http) running a .net 4.0 site.

Here's some packet samples

Failing request

GET http://www.domain.com/ HTTP/1.1
Host: www.domain.com
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Via: 1.1 domain.com
X-Forwarded-For: [ipaddress]
X-Forwarded-Host: www.domain.com
X-Forwarded-Server: domain.com
Connection: Keep-Alive

Failing response

HTTP/1.1 400 Bad Request
Connection: close
Date: Fri, 11 Mar 2011 02:24:34 GMT
Content-Type: text/html; charset=utf-8

Working Request

GET / HTTP/1.1
Host: www.domain.com
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Connection: Keep-Alive

Working Response

HTTP/1.1 302 Found
Date: Fri, 11 Mar 2011 02:29:12 GMT
Location: /Account/Login/?ReturnUrl=%2f
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 146

These two requests are for the same site, one via proxy one direct. The only thing I can see of any significance is the value for each get. One is a path and the other is a domain and path. But as I mentioned, all I have to do I switch the website in IIS6 to use the 2.0 runtime and not the 4.0 runtime.

Anyne got any ideas about what might be the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汹涌人海 2024-10-28 11:54:22

这个问题的答案是apache中virtualhost的配置错误
我不得不注释掉我错误地放置在其中的 ProxyRemote 指令。

The answer to this question was a mistake in the configuration of the virtualhost in apache
I had to comment out the ProxyRemote directive that i had in there by mistake.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文