# How do I change path for backend

**URL:** <https://discourse.haproxy.org/t/how-do-i-change-path-for-backend/2616>\
**Category:** Help!\
**Created:** [June 13, 2018, 11:10pm UTC](https://discourse.haproxy.org/t/how-do-i-change-path-for-backend/2616 "2018-06-13T23:10:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbrahy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jbrahy/32/525_2.png) [@jbrahy](https://discourse.haproxy.org/u/jbrahy)\
**Post date:** [June 13, 2018, 11:10pm UTC](https://discourse.haproxy.org/t/how-do-i-change-path-for-backend/2616/1 "2018-06-13T23:10:10Z")

</div>

I have a path I’m using to identify itself to for an acl but I need a different path for the backend server. How do I remove the first three characters of the path before passing to the backend? passed in the path is /rd/asdffdsa1213 and to the backend server it should be /asdffdsa123.

```
backend backend-http
    option forwardfor
    server web-1 site.website1.com:80 check

```

Is that possible? I saw an example using this.

```
http-request set-uri %[url,regsub(^/rd,/,)]

```

Is that the right approach? I tried it but it gave me an error. It may be the version of haproxy.

```
[root@pm-prod-haproxy01 b738cbea49eaded323220988d9e184ee]# haproxy -f /etc/haproxy/haproxy.cfg
[ALERT] 163/161449 (10421) : parsing [/etc/haproxy/haproxy.cfg:45]: 'http-request' expects 'allow', 'deny', 'auth', 'redirect', 'tarpit', 'add-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', 'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', but got 'set-uri'.
[ALERT] 163/161449 (10421) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg

[root@pm-prod-haproxy01 b738cbea49eaded323220988d9e184ee]# haproxy -v
HA-Proxy version 1.5.18 2016/05/10
Copyright 2000-2016 Willy Tarreau <willy@haproxy.org>

[root@pm-prod-haproxy01 b738cbea49eaded323220988d9e184ee]#
```

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [June 13, 2018, 11:45pm UTC](https://discourse.haproxy.org/t/how-do-i-change-path-for-backend/2616/2 "2018-06-13T23:45:48Z")

</div>

You need at least 1.6 for the `http-request set-uri` feature.

Take a look at [reqrep](https://cbonte.github.io/haproxy-dconv/1.5/configuration.html#4.2-reqrep), you can likely cover your use case with that.

---

<div class="post-metadata">

**Author:** ![jbrahy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jbrahy/32/525_2.png) [@jbrahy](https://discourse.haproxy.org/u/jbrahy)\
**Post date:** [June 13, 2018, 11:52pm UTC](https://discourse.haproxy.org/t/how-do-i-change-path-for-backend/2616/3 "2018-06-13T23:52:24Z")

</div>

Ok, thanks! I’ve seen that the regex engine is a performance penalty. Should I continue that direction or upgrade? I’m just using the vanilla version from centos 7. Seems like it’s best to update to latest anyway now that I see it’s 1.8.

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [June 14, 2018, 12:13am UTC](https://discourse.haproxy.org/t/how-do-i-change-path-for-backend/2616/4 "2018-06-14T00:13:06Z")

</div>

How much the performance penalty is due to the regex is depends on the expression. Your set-uri example in the first post is just another regex - so whether you use that or reqrep really does not matter.

Also the performance penalty is very likely minuscule.
