我们目前正在使用互联网云提供商来承载我们的SaaS平台。该平台由防火墙->云提供商SLB -> -> Apache -> HAPROXY SLB -> Liferay平台组成。
由于云提供商SLB的问题,我们不得不使用HAPROXY,这意味着我们无法使用它来平衡Liferay平台应用程序的负载。
我已经在我们的安全层中实现了HAPROXY,这似乎能够充分地实现负载平衡请求。
然而,在测试过程中,我们遇到了一个功能问题,即从门户网站选择子菜单会导致应用程序挂起,使用http分析器,我们看到被传递回用户浏览器的请求位于http,通过与软件供应商讨论这个问题,我们发现Liferay应用程序有一些硬编码的http链接,其他客户通过使用物理NLB的F5和将http流量重定向到https来解决这个问题。
HAPROXY日志中的条目如下:
haproxy[2717]: haproxy[2717]: <Apache Web Agent>:37957 [11/Apr/2013:08:07:00.128] http-uapi uapi/<ServerName> 0/0/0/9/10 200 4912 - - ---- 4/2/1/2/0 0/0 "GET /servicedesk/controller?docommand=renderradform&!key=esd_sfb001_frm_feedback_forms_list&isportalintegratedmode=true&USR=joe.bloggs%40gmail.com&_dc=1365667773097&redirecturl=controller%3Fdocommand%3Drenderbody%26%21key%3DESD_SFB001_FRM_FEEDBACK_FORMS_LIST%26isportalintegratedmode%3Dtrue&sso_token=ALiYv2UqzLsAhSw1ZchRDlCHlq44Bhj9&ONERROR=%2Fweb%2Fjsp%2Fapps%2Fportal-integration-error.jsp&itype=login&slicetoken=NW51O%242aRo%2C_Zz%2476P_9DTtnFmz6%28bhk&AUTOFORWARDURL=controller%3Fdocommand%3Drenderbody%26%21key%3DESD_SFB001_FRM_FEEDBACK_FORMS_LIST%26isportalintegratedmode%3Dtrue&LOGINPAGE=https%3A%2F%2F<FQDN of Web Portal>%2Fweb%2F4732cf01-82c3-4bc5-b6c9-552253e672cf%2Fworkflow-tools&appid=1&!uid=1&!redownloadToken=7.0.3.1.1363611301.0&userlocale=en_US&!datechanged=2012-05-18%2015:05:31.38 HTTP/1.1"
:37957 [11/Apr/2013:08:07:00.128] http-uapi uapi/<ServerName> 0/0/0/9/10 200 4912 - - ---- 4/2/1/2/0 0/0 "GET /servicedesk/controller?docommand=renderradform&!key=esd_sfb001_frm_feedback_forms_list&isportalintegratedmode=true&USR=joe.bloggs%40gmail.com&_dc=1365667773097&redirecturl=controller%3Fdocommand%3Drenderbody%26%21key%3DESD_SFB001_FRM_FEEDBACK_FORMS_LIST%26isportalintegratedmode%3Dtrue&sso_token=ALiYv2UqzLsAhSw1ZchRDlCHlq44Bhj9&ONERROR=%2Fweb%2Fjsp%2Fapps%2Fportal-integration-error.jsp&itype=login&slicetoken=NW51O%242aRo%2C_Zz%2476P_9DTtnFmz6%28bhk&AUTOFORWARDURL=controller%3Fdocommand%3Drenderbody%26%21key%3DESD_SFB001_FRM_FEEDBACK_FORMS_LIST%26isportalintegratedmode%3Dtrue&LOGINPAGE=https%3A%2F%2F<FQDN of Web Portal>%2Fweb%2F4732cf01-82c3-4bc5-b6c9-552253e672cf%2Fworkflow-tools&appid=1&!uid=1&!redownloadToken=7.0.3.1.1363611301.0&userlocale=en_US&!datechanged=2012-05-18%2015:05:31.38 HTTP/1.1"相应的HTTP浏览器条目显示:
http://<FQDN of ServiceDesk>/servicedesk/controller?docommand=renderradform&!key=esd_org019_frm_contact_list&isportalintegratedmode=true&USR=joe.bloggs%40gmail.com&_dc=1365665987887&redirecturl=controller%3Fdocommand%3Drenderbody%26%21key%3DESD_ORG019_FRM_CONTACT_LIST%26isportalintegratedmode%3Dtrue&sso_token=3NxsXYORMPp32SwL8ftVUCMH2QdWLH82&ONERROR=%2Fweb%2Fjsp%2Fapps%2Fportal-integration-error.jsp&itype=login&slicetoken=NW51O%242aRo%2C_Zz%2476P_9DTtnFmz6%28bhk&AUTOFORWARDURL=controller%3Fdocommand%3Drenderbody%26%21key%3DESD_ORG019_FRM_CONTACT_LIST%26isportalintegratedmode%3Dtrue&LOGINPAGE=https%3A%2F%2F<FQDN of Web Portal>>%2Fweb%2F4732cf01-82c3-4bc5-b6c9-552253e672cf%2Fapplication-setup&appid=1&!uid=1&!redownloadToken=7.0.3.1.1363611301.0&userlocale=en_US&!datechanged=2012-10-26%2019:00:25.08从阅读论坛和其他网站看上去,我们应该使用HAPROXY将流量重定向到https,但我尽量尝试,我无法让它工作。
这是我们的HAPROXY配置:
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
frontend http-openfire
bind *:7070
default_backend openfire
backend openfire
balance roundrobin
server <serverName> <IPv4 Address>:7070 check
server <serverName> <IPv4 Address>:7070 check
frontend http-uapi
bind *:7080
default_backend uapi
backend uapi
balance roundrobin
server <serverName> <IPv4 Address>:7080 check
server <serverName> <IPv4 Address>:7080 check
frontend http-sec
bind *:8080
default_backend sec
backend sec
balance roundrobin
server <serverName> <IPv4 Address>:8080 check
server <serverName> <IPv4 Address>:8080 check
frontend http-wall
bind *:9080
default_backend wall
backend wall
balance roundrobin
server <serverName> <IPv4 Address>:9080 check
server <serverName> <IPv4 Address>:9080 check
frontend http-xmpp
bind *:9090
default_backend xmpp
backend xmpp
balance roundrobin
server <serverName> <IPv4 Address>:9090 check
server <serverName> <IPv4 Address>:9090 check
frontend http-aim
bind *:10080
default_backend aim
backend aim
balance roundrobin
server <serverName> <IPv4 Address>:10080 check
server <serverName> <IPv4 Address>:10080 check
frontend http-servicedesk
bind *:8081
default_backend servicedesk
backend servicedesk
balance roundrobin
server <serverName> <IPv4 Address>:8081 check
server <serverName> <IPv4 Address>:8081 check
listen stats :1936
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth haproxy:<Password>我试着跟踪在https://stackoverflow.com/questions/13227544/haproxy-redirecting-http-to-https-ssl和http://parsnips.net/haproxy-http-to-https-redirect/上发布的文章,但这并没有起到任何作用。
我是在正确的轨道上,还是我们试图实现不可能?,我希望我只是一个白痴和你们中的一个好人可以指出我的正确方向。
发布于 2013-06-01 04:34:13
https://serverfault.com/questions/498339
复制相似问题