0

Ok, I'm feeling a bit stupid about this.

I'm trying to setup a simple Apache reverse proxy setup and I'm hitting a wall. I've had this setup working in the past, but now I just don't see whats going wrong. Heres the setup:

Listen 4050 ServerName lb-test DocumentRoot /www/app ProxyRequests Off Header add Set-Cookie "BALANCEID=hej.%{BALANCER_WORKER_ROUTE}e; path=/;" env=BALANCER_ROUTE_CHANGED <Proxy balancer://cluster> BalancerMember http://appserver1:4050 route=appserver1 BalancerMember http://appserver2:4050 route=appserver2 Order deny,allow Allow from all </Proxy> ProxyPass /balancer-manager ! ProxyPass / balancer://cluster/ stickysession=BALANCEID ProxyPassReverse / balancer://cluster/ <Location /balancer-manager> SetHandler balancer-manager Order deny,allow Deny from None Allow from all </Location> 

I can see in the log with debug turned on that requests are being routed to a balancer member, but what is also happening is that the proxy host url is also being inserted into the header.

From the lb host: curl -I localhost

HTTP/1.1 200 OK Date: Wed, 11 Apr 2012 17:33:18 GMT Server: thin 1.3.1 codename Triple Espresso Content-Type: text/html; charset=utf-8 Via: 1.1 appserver2:4050 Via: 1.1 lb-test Set-Cookie: BALANCEID=hej.appserver2; path=/; 

As you can see both hosts are in the header, which is breaking the application. I would think that hitting localhost:80 would not trigger mod_proxy, right? If I hit localhost:4050, the same thing happens. Anyone know whats going on?

Thanks

10
  • Can you clarify how the application is breaking due to Via headers? Or is it the Host header on the request that's causing problems? Commented Apr 11, 2012 at 18:27
  • Its probably the host header. Its passing lb-test, appserver2:4050 through to the application. Commented Apr 11, 2012 at 20:19
  • It should just be sending appserver2:4050, the multi-header format isn't allowed for Host. In any case, Tom's answer should be what you need. Commented Apr 11, 2012 at 20:39
  • I tried that, same problem. Response headers still have: Via 1.1 appserver2:4050, 1.1 lb-test:4050 when i hit http://lb-test:4050/ Commented Apr 11, 2012 at 21:00
  • Can you capture a request with tcpdump between the proxy and the backend server? Making guesses at the request header fields is a poor substitute for being able to actually see them. Commented Apr 11, 2012 at 21:06

1 Answer 1

2

you should set;

ProxyPreserveHost On

in your vhost configuration

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.