Lighttpd reverse proxy converts HTTP/1.1 requests to 1.0

为君一笑 提交于 2019-12-12 18:41:35

问题


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).

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.".

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

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


回答1:


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;
}


来源:https://stackoverflow.com/questions/21677776/lighttpd-reverse-proxy-converts-http-1-1-requests-to-1-0

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