我目前在AppFog上有两个应用,它们是。
http://sru-forums-prod.aws.af.cm/和http://sru-home-prod.aws.af.cm/
我在本地计算机上运行了haProxy,这是我当前的配置文件。
全局调试
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将流量转发到sru-home-prod,而localhost:8232/forums/*将流量转发到sru-forums prod。然而,我甚至不能让一个简单的代理启动和运行。
当我在这个配置文件上运行HAProxy时,我收到了AppFog 404 Not Found at LocalHost8232。
我漏掉了什么,这有可能吗?
编辑:
新的配置可以工作,但现在我在响应中返回了一个端口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发布于 2012-09-26 03:39:47
找不到AppFog 404的原因是因为托管在AppFog上的应用程序是通过域名路由的。为了让AppFog知道为您提供服务的应用程序,域名必须包含在HTTP请求中。当你转到本地主机:8232/论坛/时,它会发送本地主机作为域名,而AppFog并没有注册的应用程序名。
有一个很好的方法来解决这个问题。
1)将您的应用映射到第二个域名,例如:
af map <appname> sru-forums-prod-proxy.aws.af.cm2)编辑您的/etc/hosts文件并添加以下行:
127.0.0.1 sru-forums-prod-proxy.aws.af.cm3)转到http://sru-forums-prod-proxy.aws.af.cm:8232/forums/,它将映射到本地计算机,但会成功地通过您的haproxy,最终将正确的主机名映射到托管在AppFog上的应用程序。
这里是一个有效的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 /haproxyhttps://stackoverflow.com/questions/12539370
复制相似问题