2 messages in ru.sysoev.nginxRe: sub_filter and regexen?
FromSent OnAttachments
Simon MullisNov 13, 2007 3:01 am 
Evan MillerDec 29, 2007 2:46 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: sub_filter and regexen?Actions...
From:Evan Miller (emmi@public.gmane.org)
Date:Dec 29, 2007 2:46:22 pm
List:ru.sysoev.nginx

Simon Mullis wrote:

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

(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;