HAProxy URL重写
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HAProxy URL重写相关的知识,希望对你有一定的参考价值。
In this example:*rewrite urls from domain.com to www.domain.com*
This is somewhat documented elsewhere, but not very well, so here's an example on how to perform simple URL rewriting with HAProxy (instead of using mod_rewrite with apache).
This works great if your servers use lighttpd, nginx, or anything that doesnt provide its own simple url rewriting.
frontend webserver bind :80 mode http acl is_www hdr_beg(host) -i www.domain.com use_backend http_cluster if is_www default_backend http_redir backend http_redir mode http balance source option nolinger server web 127.0.0.1:8080 redir http://www.domain.com backend http_cluster mode http option forwardfor balance source option httpclose option httpchk HEAD / HTTP/1.0 server web01 172.16.0.11:80 weight 1 check inter 1000 rise 5 fall 1 server web02 172.16.0.12:80 weight 1 check inter 1000 rise 5 fall 1 server web03 172.16.0.13:80 weight 1 check inter 1000 rise 5 fall 1 server web04 172.16.0.14:80 weight 1 check inter 1000 rise 5 fall 1
以上是关于HAProxy URL重写的主要内容,如果未能解决你的问题,请参考以下文章