11 messages in ru.sysoev.nginxRe: GZIP problem with backend hosts
FromSent OnAttachments
Alan WilliamsonAug 28, 2008 4:36 am 
ngin...@public.gmane.orgAug 28, 2008 9:22 am 
Alan WilliamsonAug 29, 2008 1:41 am 
Igor SysoevAug 29, 2008 1:54 am 
Alan WilliamsonAug 29, 2008 3:04 am 
Igor SysoevAug 29, 2008 3:15 am 
Alan WilliamsonAug 29, 2008 4:07 am 
Igor SysoevAug 29, 2008 4:26 am 
Olivier BonvaletAug 29, 2008 4:32 am 
Alan WilliamsonAug 29, 2008 4:46 am 
Igor SysoevAug 29, 2008 4:58 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: GZIP problem with backend hostsActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Aug 29, 2008 4:26:44 am
List:ru.sysoev.nginx

On Fri, Aug 29, 2008 at 12:08:21PM +0100, Alan Williamson wrote:

If you did not set proxy_set_header Accept-Encoding "";

then nginx will pass it backend.

i do not understand this. Are you suggesting i need to set this in order for nginx to send that header to the back end?

No, if you set this then nginx will never pass Accept-Encoding to backend.

What about the other headers that get sent with the request (cookie etc) we don't manually set them do we? They simply get passed to the backend.

By default all headers goes to backend as is. There are two exceptions:

1) Host: nginx sets it to $proxy_host value, 2) Connection: nginx sets it "close"

It always bothers me that nginx doesn't pass "Host:" one and i have to set this manually, makes me wonder what other headers nginx is silently rejecting and not passing on to the backend.

nginx always sends Host. However, it sets to a value that backend usually expects to get. In this configuration:

server { server_name ONE; location / { proxy_pass http://TWO; } }

the TWO server usually expects to get "Host: TWO", but not "Host: ONE" as the ONE server expects. If your TWO server requires "Host: ONE", then you have to add manually

proxy_set_header Host $host; or proxy_set_header Host ONE;

can you tell me what the definitive answer is here?

------ snippet ------- location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header x-forwarded-for $remote_addr; proxy_pass http://backends; }

-----------------------

Try to remove

proxy_set_header x-forwarded-for $remote_addr;

This may be treated as proxied request on backend side.

So if a client sends in the header that he can accept GZIP encoding, nginx is removing this and not passing it through.

So how can i add it back in, but for only the clients that can accept it; a bit silly to ALWAYS add it in especially if its not been set.

As I have said before nginx does not remove "Accept-Enconding" by default.

I do not know conditions when Amazon may refuse to compresses response, it may have simillar limits as nginx has:

this has ***nothing*** to do with Amazon. I merely was illustrating that our infastructure runs within the EC2 cloud.

As I understand EC2 cloud are Amazon servers. Are your backends EC2 servers ?