Sub_filter and regexen?

Hi All,

Following on from my fun with proxy_pass yesterday…

Problem: Application with dedicated httpd server over which I have no
control. I want to present this to external web clients.
Proxy pass now works great. The relative hrefs in html created by the
httpd application are no incorrect and need to be prepended with the
appropriate path.

I can’t seem to find any detail in the docs regarding the sub_filter
module.

Does the sub_filter module accept regexes? I specifically want to use
capture groups for a search and replace.

e.g. rewrite all hrefs in a page

location /new/long/path {
rewrite ^/new/long/path/(.*) /$1 break;
proxy_pass http://127.0.0.1:2812
sub_filter href=‘(.+)’> href=‘/new/long/path/$1’>;
sub_filter_once off;
}

Thanks in advance for any help with this.

Kind Regards

SM

Simon M. wrote:

I can’t seem to find any detail in the docs regarding the sub_filter module.
sub_filter_once off;
}

Thanks in advance for any help with this.

Kind Regards

SM

(Just going through some old posts.) The sub_filter module does not
accept regexes. But for the example above perhaps you could just:

 sub_filter "<a href='" "<a href='/new/long/path/";
 sub_filter_once off;