sub_filter and regexen?

Simon Mullis simon at
Tue Nov 13 14:02:06 MSK 2007

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;
    sub_filter  href='(.+)'> href='/new/long/path/$1'>;
    sub_filter_once off;

Thanks in advance for any help with this.

Kind Regards


Simon Mullis
simon at

More information about the nginx mailing list