HTTP/1.0 proxied as HTTP/1.1
Created by: fidian
Sample code:
require('http-proxy').createServer(80, 'localhost').listen(8001);
Sample request:
GET /phpinfo.php HTTP/1.0
Host: localhost:8001
Request that goes to the server:
GET /phpinfo.php HTTP/1.1
host: localhost:8001
x-forwarded-for: 127.0.0.1
x-forwarded-port: 38349
x-forwarded-proto: http
Connection: close
The server's response for this page looks like this:
HTTP/1.1 200 OK
Date: Thu, 09 Jun 2011 14:53:41 GMT
Server: Apache/2.2.17 (Ubuntu)
X-Powered-By: PHP/5.3.5-1ubuntu7.2
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
259f
<html><head>...lots of HTML
The response to the client looks identical. This, unfortunately, breaks the HTTP/1.0 response since now we are both sending an HTTP/1.1 status and we are doing chunked encoding. The HTTP/1.0 client can't understand this.
The fix: Make the request to the server an HTTP/1.0 request to mirror the client's desires perfectly.