I'm using HAProxy to set a cookie when you visit
mydomain.com/dev and redirects to
The purpose of this is to offer a way to visit a development version of the site instead of the production site, while keeping everything else the same.
The pertinent config line looks something like this:
frontend webfarm 220.127.116.11:80 acl acl_dev path_end /dev redirect location / code 302 set-cookie SERVERID=live03 if acl_dev default_backend default_farm
Now, instead of redirecting to the root domain, I'd just like to strip off the /dev path. So if I went to
mydomain.com/foo/dev it would set the cookie and redirect to
Is this possible with HAProxy, or would I need to use mod_rewrite in the apache backend server?
Note: I don't need a mod_rewrite rule, just looking for whether this is possible in HAproxy.