Skip to content

v0.2.0 causes express?/connect? to return back 404 when no headers are sent. #47

Open
swang opened this Issue Nov 30, 2012 · 1 comment

2 participants

@swang
swang commented Nov 30, 2012

May be related to #43

We currently have a load balancer that pings /health of all the servers to decide which ones are still up. It sends it as a headerless request that expects a 200 response with OK written in plain text. Our app is running on Express 2.5.8

Updating to 0.2.0 of gzippo causes Express to return a 404 error when it gets sent to any page in express that doesn't have proper headers defined. I tested this by running curl -I http://localhost:8080/health and get

HTTP/1.1 404 Not Found
X-Powered-By: Express
Date: Fri, 30 Nov 2012 23:18:46 GMT
Connection: keep-alive

Not sure how to fix this, and it seems like 0.2.0 is not currently on GitHub.

Note version 0.1.7 works and returns a 200 Response

HTTP/1.1 200 OK
X-Powered-By: Express
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Content-Length: 2
Date: Fri, 30 Nov 2012 23:13:51 GMT
Connection: keep-alive

@underbluewaters

I'm experiencing similar problems with those same versions. Calling up any url on my Express 2.5.8 app with curl and default arguments results in a 404. Downgrading to 0.1.7 fixes the problem. Requesting these same routes with my browser is fine.

It seems to be related to the presence of an Accept-Encoding header. See without header:

$ curl -v localhost:3000/healthcheck* About to connect() to localhost port 3000 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /healthcheck HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:3000
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< X-Powered-By: Express
< X-UA-Compatible: IE=Edge,chrome=IE8
< Date: Fri, 07 Dec 2012 17:32:12 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
Not Found* Closing connection #0

And with Accept-Encoding header:

$ curl --header 'Accept-Encoding:gzip,deflate,sdch' -v localhost:3000/healthcheck
* About to connect() to localhost port 3000 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /healthcheck HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:3000
> Accept: */*
> Accept-Encoding:gzip,deflate,sdch
> 
< HTTP/1.1 200 OK
< X-Powered-By: Express
< X-UA-Compatible: IE=Edge,chrome=IE8
< Content-Type: text/html; charset=utf-8
< Content-Length: 2
< Date: Fri, 07 Dec 2012 17:30:26 GMT
< Connection: keep-alive
< 
* Connection #0 to host localhost left intact
OK* Closing connection #0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.