Apache responses with http/1.0 even if request is http/1.1

落花浮王杯 提交于 2021-02-10 14:23:03

问题


I configured Apache Http server version 2.4 as proxy for backend server (Glassfish App Server actually). MPM is worker.

Configuration is mostly default. Configuration for proxy

ProxyPass /context/ http://backend.com:8080/context/ keepalive=On ttl=25 timeout=300 max=50
ProxyPassReverse /context/ http://backend.com:8080/context/

I open page in browser and it sends GET http://example.com/context HTTP/1.1 to Apache. Apache returns response HTTP/1.0 200 OK with Connection: close header. But actual backend server response contains HTTP/1.1 200 OK.

Why does Apache downgrade proxied response from 1.1 to 1.0?


回答1:


force-no-vary is the cause. Documentation says:

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.




回答2:


In my case we were writing PHP using HTTPFoundation's Response object. It defaults to HTTP/1.0.



来源:https://stackoverflow.com/questions/25266860/apache-responses-with-http-1-0-even-if-request-is-http-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!