Lighttpd反向代理将HTTP/1.1请求转换为1.0 [英] Lighttpd reverse proxy converts HTTP/1.1 requests to 1.0

查看:457
本文介绍了Lighttpd反向代理将HTTP/1.1请求转换为1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用lighttpd作为一组Play实例的反向代理,这些实例目前在2.1.1版中. Play应用程序使用分块传输编码来进行COMet(服务器推送). Lighttpd版本是1.4.28(Ubuntu 12.04最新支持的版本).

I'm using lighttpd as a reverse proxy for a group of Play instances, which are on version 2.1.1 at the moment. The Play applications use chunked transfer encoding to do COMet (server push). Lighttpd version is 1.4.28 (latest supported version for Ubuntu 12.04).

此设置运行良好,但是现在我要升级到Play Framework 2.2.1.现在,播放框架强制要求分块响应必须是对HTTP/1.0请求的响应(请参见 https://github.com/playframework/playframework/commit/5131c46626b82f966a9b7894cf9bfcdc1b464f3e ),事实证明,我的lighttpd代理正在将HTTP/1.1请求转换为HTTP/1.0. Play的确切响应是505,并显示消息"The response to this request is chunked and hence requires HTTP 1.1 to be sent, but this is a HTTP 1.0 request.".

This setup is working nicely, but now I'm upgrading to Play Framework 2.2.1. The play framework now enforces that chunked responses must be in response to a HTTP/1.0 request (see https://github.com/playframework/playframework/commit/5131c46626b82f966a9b7894cf9bfcdc1b464f3e), and it turns out that my lighttpd proxy is converting HTTP/1.1 requests to HTTP/1.0. The exact response from Play is a 505, with the message "The response to this request is chunked and hence requires HTTP 1.1 to be sent, but this is a HTTP 1.0 request.".

那下一步呢?我不知道我的哪个替代方案(获取最新版本的lighttpd,切换到nginx)可能可行.

So where next? I don't know which of my alternatives (get the latest version of lighttpd, switch to nginx) is likely to work.

更新:lighttpd看起来没有什么希望,因为mod_proxy.c具有HTTP/1.0硬编码,即使它确实可以处理分块编码.

UPDATE: lighttpd doesn't look promising, as mod_proxy.c has HTTP/1.0 hardcoded, even though it does handle chunked encoding.

推荐答案

我通过将Lighttpd替换为Nginx作为我的反向代理来解决了这个问题.这是确切的Nginx配置节,将位于server部分中:

I solved the problem by replacing Lighttpd with Nginx as my reverse proxy. Here's the exact Nginx configuration stanza, which will be within a server section:

location / {
    proxy_http_version 1.1;    
    proxy_pass http://127.0.0.1:8080;
}

这篇关于Lighttpd反向代理将HTTP/1.1请求转换为1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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