If a Picture is worth a 1000 Words: If the url does not have any path like this: http://mad-news.net/ acl has_ww_uri path_beg -i /ww returns false reqirep ^([^\ :]*)\ /(.*) \1\ /ww/\2 if !has_ww_uri http://mad-news.net/ww/en/ it adds the ww, the program with is wthttpd (Wt) defaults to en for language control Just to show you how the site looks at port 8060: http://mad-news.net:8060/ww/en/ If I comment the code, the site looks fine.
Note: I want only the first path to work: http://mad-news.net/this/ww fails to work for the rule, it does this: http://mad-news.net/ww/this/this/ww which is not what I want, so how do I write a rule to cover this? Note: If the ww is not there, the Wt app will ignore the request, results in 404 http://wittywizard.org/ vs http://wittywizard.org/ww. There is no way around this behavior is I want to have a pretty URL. My whole config, Note that it works the same in 1.4 and 1.5, but this is: HA-Proxy version 1.5.1 2014/06/24: global log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 4096 user haproxy group haproxy daemon # pidfile /var/run/haproxy.pid # stats socket /var/run/haproxy.stat mode 600 # stats socket /tmp/haproxy defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 1000 #contimeout 5000 # haproxy 1.4 timeout connect 5000 #clitimeout 50000 # haproxy 1.4 timeout client 50000 #srvtimeout 50000 # haproxy 1.4 timeout server 50000 frontend wt bind 216.224.185.71:80 # Set inside Witty Wizard main.cpp acl has_ww_uri path_beg -i /ww reqirep ^([^\ :]*)\ /(.*) \1\ /ww/\2 if !has_ww_uri redirect prefix http://wittywizard.org code 301 if { hdr(host) -i www.wittywizard.org } # Note: see wthttpd.sh session-id-prefix acl srv1 url_sub wtd=wt-8060 acl srv1_up nbsrv(bck1) gt 0 use_backend bck1 if srv1_up srv1 # Second Thread # Note: see wthttpd.sh session-id-prefix # acl srv2 url_sub wtd=wt-8061 # acl srv2_up nbsrv(bck2) gt 0 # use_backend bck2 if srv2_up srv2 has_ww_uri # default_backend bck_lb # backend bck_lb balance roundrobin #server srv1 108.59.251.28:8060 track bck1/srv1 server srv1 216.224.185.71:8060 track bck1/srv1 backend bck1 balance roundrobin #server srv1 108.59.251.28:8060 check server srv1 216.224.185.71:8060 check backend bck2 balance roundrobin #server srv2 108.59.251.28:8061 check server srv2 216.224.185.71:8060 check As you can see, the path seems to have changed, not sure what is going on, any ideas? Thanks On Thu, 2014-07-03 at 22:40 +0200, Baptiste wrote: > On Thu, Jul 3, 2014 at 9:38 PM, Jeffrey Scott Flesher Gmail > <jeffrey.scott.fles...@gmail.com> wrote: > > I have a url that always begins with ww, ie http://domain.tdl/ww/en/..., I > > want to rewrite the url to include the ww, > > I tried the below, it works, but changes the path or something, > > because it cause the resources like css and images to not appear (404), > > does anyone know how to fix this or do this the right way? > > > > acl has_ww_uri path_beg -i /ww > > reqirep ^([^\ :]*)\ /(.*) \1\ /ww/\2 if !has_ww_uri > > > > Hi Jeffrey, > > Can you clarify a bit your question, cause you're confusing me. > please send us an example of what you get in HAProxy and how you want > it out after HAProxy has rewritten it. > > Baptiste