# Rspirep - HAProxy Upgrade - Help Needed!

**URL:** <https://discourse.haproxy.org/t/rspirep-haproxy-upgrade-help-needed/8982>\
**Category:** Help!\
**Created:** [August 30, 2023, 12:00pm UTC](https://discourse.haproxy.org/t/rspirep-haproxy-upgrade-help-needed/8982 "2023-08-30T12:00:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ash](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Ash](https://discourse.haproxy.org/u/Ash)\
**Post date:** [August 30, 2023, 12:00pm UTC](https://discourse.haproxy.org/t/rspirep-haproxy-upgrade-help-needed/8982/1 "2023-08-30T12:00:29Z")

</div>

Hi All,

I have just upgraded from 1.5.2 to 2.4.14 , and as you may all know rspirep is no longer supported, and I need to use http-response replace-header instead, but am having issues getting it working with backslashes followed by numbers, which by the documentation, seems to be supported in 2.4

[https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#http-request%20replace-header](https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#http-request%20replace-header)

This is what was previously configured:

rspirep ^(Location:)\ http://([^/]_)/(._)$ \1\ https://\2/\3

I tried the following, but none worked unfortunately:

Option 1: http-response replace-header Location (http://[^/]_)/(._) \1 https://\2 if { hdr(Location) -m found }

[ALERT] (5279) : parsing [/etc/haproxy/haproxy.cfg:66] : error detected in proxy ‘X’ while parsing ‘http-request replace-header’ rule : regex ‘Location: https://\1/\2’ is invalid (error=reference to non-existent subpattern, erroffset=23).

Option 2:

http-request replace-header ^Location:\ http://([^/]_)/(._)$ Location:\ https://\1/\2 if { hdr(Location) -m found }

Error 2:

[ALERT] (5279) : parsing [/etc/haproxy/haproxy.cfg:66] : error detected in proxy ‘X’ while parsing ‘http-request replace-header’ rule : regex ‘Location: https://\1/\2’ is invalid (error=reference to non-existent subpattern, erroffset=23).

I would highly appreciate any help anyone can give.

Thanks,  
Ash

---

<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:** [August 30, 2023, 3:04pm UTC](https://discourse.haproxy.org/t/rspirep-haproxy-upgrade-help-needed/8982/2 "2023-08-30T15:04:41Z")

</div>

```
http-response replace-header Location ^http://(.*) https://\1

```

You can find more example of this syntax in the docs of the http-request equivalent:

[http://docs.haproxy.org/2.4/configuration.html#4.2-http-request%20replace-header](http://docs.haproxy.org/2.4/configuration.html#4.2-http-request%20replace-header)
