Reputation: 4701
I am trying to configure HAproxy running on one server to forward requests to some apps I have running on appfog but it has stopped working. I have checked my configurations but I can't spot the problem.
I suspect the host information is not being forwarded correctly because when I enter the domain1.com I am routed to domain1.app.com on appfog but the server throws a 404.
This is my configuration file -
global
maxconn 4096
user haproxy
group haproxy
daemon
log 127.0.0.1 local0 info
log 127.0.0.1 local1 notice
defaults
log global
mode http
option httplog
option dontlognull
option originalto
option forwardfor
stats enable
stats auth domain1:xxxxxx
option httpclose
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
backend domain1_at_appfog
reqirep ^Host:\ domain2.com Host:\ domain2.web.app.com
server appfog1 domain2.web.app.com:80
backend domain2_at_appfog
reqirep ^Host:\ domain1.com Host:\ domain1.app.com
server appfog2 domain1.app.com:80
backend local_host_site
server this1 127.0.0.1:8080
frontend superliciousLove *:80
acl www_domain1 hdr_dom(host) -i www.domain1.com
acl local_host url_sub www2
use_backend domain1_at_appfog if www_domain1
use_backend local_host_site if local_host
default_backend domain1_at_appfog
Upvotes: 0
Views: 2176
Reputation: 5012
Based on the example provided, if it is accurate, then the problem is here:
backend domain1_at_appfog
reqirep ^Host:\ domain2.com Host:\ domain2.web.app.com
server appfog1 domain2.web.app.com:80
Your ACL is checking for www.domain1.com, and routes to backend domain1_at_appfog
. However, you are doing a replacement on domain2.com
instead of domain1.com
, and appfog is only seeing domain1.com
instead of the re-mapped host name.
If you need the backend to support more than one domain, you can change your use of reqirep
to replace all matching hosts with the appfog host:
backend domain1_at_appfog
reqirep ^Host: Host:\ domain1.web.app.com
server appfog1 domain1.web.app.com:80
backend domain2_at_appfog
reqirep ^Host: Host:\ domain2.app.com
server appfog2 domain2.app.com:80
Upvotes: 1