Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Currently, I have nginx > 25 x nginx + fcgi

The main nginx, does the load balancing and each virtualhost listens to a different ip (different products).

some of the ips receive different hostnames, and they get rewritten back to the backend servers like:


GET /path HTTP/1.1

Host: app1




We're currently replacing the main proxy with haproxy (better load balancing algorithms) but I can't figure out how to append the original host. (I can't find any documentation on variables like nginx's $host).

I can rewrite the url like:

reqirep ^Host: Host:\ app1

but "app1" still requires the original hostname to do business logic.

I thought about running each app on a different port but the problem is that I want nginx's httpchk to work for all the backend servers, and doing one backend per app means 10 apps x 10 checks = 10 checks per second to each backend (unless the log data lied).

Anyone have an Idea?

share|improve this question

Just leave the Host header alone - HAProxy doesn't molest it normally, so if you leave it alone it will be passed to your application servers.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.