Httpd Location directive seems to suppress Substitute

Solution 1:

The problem was that Httpd (I can't tell if that's by default or from an existing configuration) zips response bodies, so trying to apply any regular expression to compressed HTML wasn't matching anything (nor giving any error or hint about that).

In the former configuration, HTML content replacement was made possible by this directive:

SetOutputFilter INFLATE;proxy-html;DEFLATE

Of course after I moved all the mod_proxy_html directives inside <Location /> that SetOoutputfilter was no more active on the /public/api path.

So I reworded the <If> content like this:

<If "%{QUERY_STRING} =~ /processAction=clientData/">

    SetOutputFilter INFLATE;DEFLATE
    AddOutputFilterByType SUBSTITUTE application/json
    Substitute s|"(url-[^:]+)"\s*:\s*"/pwm(/?)([^,\}]*)"|"$1":"/$3"|q

</If>

and everything workend again — there's no HTML editing directive active on this location, so I left out the proxy-html filter.

The accepted answer to Apache Proxying leads to ERR_CONTENT_DECODING_FAILED error helped on that.