Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

... http://some-random-url.com/path

GET /path HTTP/1.1

Host: app1

X-Original-Host: some-random-url.com

X-Forwarded-For: 12.34.56.78

....

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.