设置haProxy以便在Appfog上切换多个应用程序

我目前在AppFog有两个应用程序,他们是。

http://sru-forums-prod.aws.af.cm/和http://sru-home-prod.aws.af.cm/

我有我的电脑本地运行haProxy,这是我目前的configuration文件。

全局debugging

defaults mode http timeout connect 500ms timeout client 50000ms timeout server 50000ms backend legacy server forums sru-forums-prod.aws.af.cm:80 frontend app *:8232 default_backend legacy 

最终目标是localhost:8232将stream量转发到sru-home-prod,而localhost:8232 / forums / *将stream量转发到sru-forums-prod。 但是,我甚至不能得到一个简单的代理启动和运行。

当我运行HAProxyclosures这个configuration文件时,我收到AppFog 404 Not Found at localhost:8232。

我错过了什么,甚至有可能?

编辑:

新的configuration工程,但现在我有一个端口60032回来响应。

 global debug defaults mode http timeout connect 500ms timeout client 50000ms timeout server 50000ms backend legacy option forwardfor option httpclose reqirep ^Host: Host:\ sru-forums-prod.aws.af.cm server forums sru-forums-prod.aws.af.cm:80 frontend app *:8000 default_backend legacy 

您得到AppFog 404 Not Found的原因是因为AppFog上托pipe的应用程序是按域名路由的。 为了使AppFog知道要为您提供什么应用程序,该域名必须位于HTTP请求中。 当你去localhost:8232 /论坛/它发送本地主机作为AppFog没有作为注册的应用程序名称的域名。

有一个很好的方法来解决这个问题

1)将您的应用程序映射到第二个域名,例如:

 af map <appname> sru-forums-prod-proxy.aws.af.cm 

2)编辑你的/ etc / hosts文件并添加这一行:

 127.0.0.1 sru-forums-prod-proxy.aws.af.cm 

3)去http://sru-forums-prod-proxy.aws.af.cm:8232/forums/将映射到本地机器,但会通过您的haproxy成功结束与正确的主机名映射到您的应用程序托pipe在AppFog&#x3002;

下面是一个工作的haproxy.conf文件,演示了迄今为止,如何使用类似的方法为我们工作。

 defaults mode http timeout connect 500ms timeout client 50000ms timeout server 50000ms backend appfog option httpchk GET /readme.html HTTP/1.1\r\nHost:\ aroundtheworld.appfog.com option forwardfor option httpclose reqirep ^Host: Host:\ aroundtheworld.appfog.com server pingdom-aws afpingdom.aws.af.cm:80 check server pingdom-rs afpingdom-rs.rs.af.cm:80 check server pingdom-hp afpingdom-hp.hp.af.cm:80 check server pingdom-eu afpingdom-eu.eu01.aws.af.cm:80 check server pingdom-ap afpingdom-ap.ap01.aws.af.cm:80 check frontend app *:8000 default_backend appfog listen stats 0.0.0.0:8080 mode http stats enable stats uri /haproxy