- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我将 Apache Http 服务器 2.4 版配置为后端服务器(实际上是 Glassfish App Server)的代理。 MPM 是 worker
。
配置大部分是默认的。代理配置
ProxyPass /context/ http://backend.com:8080/context/ keepalive=On ttl=25 timeout=300 max=50
ProxyPassReverse /context/ http://backend.com:8080/context/
我在浏览器中打开页面,它向 Apache 发送 GET http://example.com/context HTTP/1.1
。 Apache 返回带有 Connection: close
header 的响应 HTTP/1.0 200 OK
。但实际后端服务器响应包含 HTTP/1.1 200 OK
。
为什么 Apache 将代理响应从 1.1 降级到 1.0?
最佳答案
force-no-vary
是原因。文档说:
force-no-vary This causes any Vary fields to be removed from the response header before it is sent back to the client. Some clients don't interpret this field correctly; setting this variable can work around this problem. Setting this variable also implies force-response-1.0.
force-response-1.0 This forces an HTTP/1.0 response to clients making an HTTP/1.0 request. It was originally implemented as a result of a problem with AOL's proxies. Some HTTP/1.0 clients may not behave correctly when given an HTTP/1.1 response, and this can be used to interoperate with them.
关于Apache 使用 http/1.0 响应,即使请求是 http/1.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25266860/
我是一名优秀的程序员,十分优秀!