I have an Apache Server that acts both as a proxy and as a reverse proxy for various BE services. One of these services - to which I do not have access - returns a response with a Location Header that I would like to change.
I can easily log this location header (beloning to the response) using the following variable: %{Location}o".
Something along the lines of:
LogFormat "%{%Y-%m-%d %H:%M:%S}t Header is: [%{Location}o] custom_format
CustomLog /path/to/log/custom.log custom_format
Yet I am not capable of manipulating (editing it with a different value or replacing it entirely with a different value)...
I tried doing an:
<If "%{Location}o !~ m#^/my-value#">
Header always set Location "/my-updated-value"
<If>
But this is not a valid syntax.
And other attempts I made to test whether the Location Header in the response matches a certain value and then changing it have failed.
Can you kindly give me pointers on how to tackle the problem?