2012-09-21 2 views
2

현재 AppFog에는 두 개의 응용 프로그램이 있습니다.haProxy를 설정하여 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 

최종 목표는 그 로컬 호스트가 : 8232 SRU - 가정 자극 트래픽 전달, 로컬 호스트 동안 : 8232/포럼/* SRU-포럼 - 자극에 트래픽을 전달합니다. 그러나 나는 간단한 프록시를 설치하여 실행하지도 않는다.

이 구성 파일에서 HAProxy를 실행하면 localhost : 8232에서 AppFog 404를 찾을 수 없습니다.

내가 누락 된 부분은 무엇입니까?

편집 :

새로운 설정 작동하지만 지금은 다시 응답 들어오는 포트 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 

답변

2

AppFog에서 찾을 수없는 이유는 AppFog에서 호스팅되는 응용 프로그램이 도메인 이름에 의해 라우팅되기 때문입니다. AppFog가 어떤 앱을 제공하는지 알기 위해서는 도메인 이름이 HTTP 요청에 있어야합니다. localhost : 8232/forums /로 이동하면 AppFog에 등록 된 앱 이름이없는 도메인 이름으로 localhost가 전송됩니다.

이 문제

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을 통해 이동합니다 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 /haproxy 
+0

HAProxy 규칙 만 사용하면 가능합니까? 위의 설정을 지금 편집하고 있는데 제대로 작동하는 것 같지만 appfog가 올바른 파일을 렌더링하지 못하게하는 이상한 포트가 다시 포함됩니다. 60032 또는 뭔가. –

관련 문제