Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am tring to use nginx and haproxy together. I am doing that because haproxy does not support gzip compression. My aim is that first using nginx for gzip compression than forward it to haproxy for loadbalance. I am Ok until that point. But while doing this, I want to create transparent proxy. Since nginx does not support tproxy, I used X-Forward-For header . Then in haproxy configuration I added source usesrc hdr_ip(X-Forwarded-For,-1) line but i got 503 error code in my browser. Without that line they works fine but not the way I want.

Thank you for any help, I hope I could explain what I want:)

share|improve this question
What are you proxying upstream? Why not enable compression there? – mahnsc Oct 14 '11 at 13:13
Sorry, but I didn't understand exactly what you mean by saying "proxying upstream". Briefly my aim is that if a gzip request come, unzip it than load balance it backend servers as non-gzip, finally send back to client as gzip. – ibrahim Oct 14 '11 at 13:22
if you mean way of a request by saying "upstream". It should be exactly like that client(gzip)->nginx(gzip)->haproxy(non-gzip)->webserver(non-gzip)->haproxy(non-g‌​zip)->nginx(gzip)->client(gzip) means it's reverse proxy... – ibrahim Oct 14 '11 at 13:52
I mean, why don't you enable gzip compression on the web or app server instead of adding haproxy or nginx into the mix? – mahnsc Oct 14 '11 at 14:00
I solved problem by reorganizing iptables rules. Thank you for interested in mahnsc... – ibrahim Oct 15 '11 at 8:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.