Rspirep / rsprep not triggering


#1

I’m trying to rewrite the contents of a response from an HTTP backend server. It’s an Icecast server so it answers on HTTP/1.0.

I would like to replace any occurrence of “http://that.server.com:8787/” with “https://that.server.com” (removing the trailing port and changing the scheme)

So my rspirep line looks like this :

rspirep http://that.server.com:8787(.*) https://that.server.com\1

… and all I get is the exact same original content :
http://that.server.com:8787/some_uri

Tried with both rsprep and rspirep in case one of them is misbehaving, no luck.

Is there something I’m missing ?


#2

This is for HTTP headers only, not the HTTP body. I assume rewriting the body is what you are trying to achieve?


#3

Yes it is!
I think I was mislead by a vocabulary error, as the doc says that this function can rewrite both headers and response. For me, the response was the actual body.

So is there any way to do that with HAProxy?


#4

I’m not sure about LUA functionality, but you definitely cannot do this with the vanilla haproxy featureset.