502 Bad Gateway when downloading file

Stefan Caunter stef at caunter.ca
Sun Oct 16 07:34:58 UTC 2011

On Sat, Oct 15, 2011 at 7:51 PM, sogi <nginx-forum at nginx.us> wrote:
> Hello all.
> I have topology as follows:
> client->NGINX->haproxy-> 4xapache servers.
> Problem is, that on one page, we have option to download file - it is
> done through changing header. Resulting header is as follows:
> Content-type: application/txt

how do you change header, and can you please post complete headers
from successful request[s] and from unsuccessful request?

> Content-Length: "xxxxx"
> Content-Disposition: attachment; filename="aaa.txt"
> I'm getting 502 Bad Gateway, The server returned an invalid or
> incomplete response error everytime after clicking on link. In logs,
> there is nothing weird.

please post any relevant log entries

 When trying it directly through HAPROXY or
> directly through nginx (pointed to one of that apache servers) it is
> working correctly.

we need to see the headers

> Do you have any idea about how to resolve it? Have anybody experienced
> something like this?
> Many thanks for any reply concerning this.

Stefan Caunter

More information about the nginx mailing list