views:

280

answers:

2

Here's a strange one:

I've got nginx reverse proxying requests to apache 2 with mod_php.

A user (using firefox 3.1b3) reported that recently, he's started getting sporadic "What should firefox do with this file?" popups during normal navigation. We haven't had any other reports of this issue, and haven't been able to reproduce it ourselves.

I checked Nginx and apache's logs. Nothing in the error logs, and they both show a normal HTTP 200 for the request.

I had him send me the downloaded file, and it's generated HTML, as it should be -- except it has some trailing and leading bytes tacked on.

The opening byte sequence is the magic gzip header: 1F8B08

Here are the opening characters, C-escaped for convenience:

\x1F\x8B\x089608\r\n<!DOCTYPE HTML ...

and the file ends with:

...</html>\n\r\n0\r\n\r\n

When I fetch the same URL via wget, it starts with as expected; the mysterious opening and closing bytes are nowhere to be seen.

Has anyone ever seen anything similar to this? Could this be a FF 3.1b3 bug?

+1  A: 

Never seen an issue exactly like that, but I did have an issue once with a transparent proxy that would claim to the web server that it could handle gzip compressed content when, in fact, it received the gzipped content from the server, stripped the gzip headers without decompressing it, and sent the result to the browser. The behavior we saw was what you describe: a save/open file dialog for what should have been a normal web page. In this case the browser in question was IE.

I'm not sure if you're problem is related, but as an experiment, you could look at the requests between the proxy and Apache and see if they are gzipped, or else turn off the gzip compression for requests in Apache and see if that fixes the issue. If so, then you probably have a problem with gzip handling in your proxy.

jbourque
I'm with jbourque on this one... it doesn't sound like a browser bug if there is content being added to the stream. Check to see if you have any gzip handlers enabled in your PHP ini, and also check to see if you have mod_deflate running on apache, and verify it's settings.
zombat
+1  A: 

wget doesn't request a compressed response. Try

curl --compressed <URL>.

You could also try adding a -v to print the response headers, check that a sensible Content-Type is being returned.

Dave Cheney