在Apache VirtualHost中使用HTTP 1.0

我想在Apache中的某个VirtualHost上只使用HTTP 1.0。 这样做的原因是我使用CloudFlare,而我的应用程序需要HTTP响应中的Content-Length标头。 但是,如果使用HTTP 1.0作为协议,则CloudFlare仅转发Content-Length标头(请参阅此支持标签: https : //support.cloudflare.com/hc/en-us/requests/527063 )。

我的问题是如何轻松地在Apache中设置一个VirtualHost来完成这个任务(强制使用HTTP 1.0作为协议)? 我是否在站点可用的configuration文件中使用SetEnv之类的东西? 或者,也许我使用HTTP 1.1协议,但发送HTTP 1.0作为头中的协议?

谢谢。

https://www.safaribooksonline.com/library/view/apache-the-definitive/0596002033/re249.html这里是使用BrowserMatch force-response-1.0variables的例子。

 # # The following directives modify normal HTTP response behavior. # The first directive disables keepalive for Netscape 2.x and browsers that # spoof it. There are known problems with these browser implementations. # The second directive is for Microsoft Internet Explorer 4.0b2 # which has a broken HTTP/1.1 implementation and does not properly # support keepalive when it is used on 301 or 302 (redirect) responses. # BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 # # The following directive disables HTTP/1.1 responses to browsers which # are in violation of the HTTP/1.0 spec by not being able to grok a # basic 1.1 response. # BrowserMatch "RealPlayer 4\.0" force-response-1.0 BrowserMatch "Java/1\.0" force-response-1.0 BrowserMatch "JDK/1\.0" force-response-1.0 

官方文档在http://httpd.apache.org/docs/2.4/env.html#special哪个州

力-响应- 1.0

这会强制HTTP / 1.0响应客户端发出HTTP / 1.0请求。 它最初是由于AOL代理人的问题而实施的。 某些HTTP / 1.0客户端在给出HTTP / 1.1响应时可能无法正确运行,并且可以用来与它们进行交互操作。