/ Published in: Apache
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.
*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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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