1

I recently was given the task of setting up a proxy and everything works great now, except that I can't seem to filter basic urls with sub_filter. This code works flawlessly

sub_filter 'anna' 'bob';

But the second I add a slash to the search pattern, like this

sub_filter '/anna' 'bob';

The filter stops working. I tried escaping the slash with a backslash but also that failed.

Is there any special regex I'm not aware of? Thanks

  • 1
    As far as I know the search pattern in a [`sub_filter`](http://nginx.org/en/docs/http/ngx_http_sub_module.html) will be matched as a case insensitive string (not a regex) and you don't need to add escapes. - Note that sub_filter is not so much *"to filter basic URL's"* but it will modify the *contents of the response body* during processing , as long as the response is of the (default) "text/html" mime type – HBruijn Apr 19 '19 at 07:49
  • The url I want to change is in the response body and it works if 'anna' is a part of the url. I changed the mime types to * so also that shouldn't be a problem. – reschandreas Apr 19 '19 at 07:54

0 Answers0