yaoweibin / ngx_http_substitutions_filter_module

a filter module which can do both regular expression and fixed string substitutions for nginx
607 stars 213 forks source link

issue with regular expression #7

Closed nginxsantos closed 10 years ago

nginxsantos commented 10 years ago

Hi,

I am using this module and it is a great. Thank you.

However, I am seeing an issue while doing regular expression.

In the response body I wanted to replace http://mysite.example.com with https://mysite.example.com

I am using the following nginx configuration and it is not working

subs_filter http://(.*).example.com https://$1.example.com ir;

Would you please lt me know what could be the issue.

makailol commented 10 years ago

@nginxsantos , It seems like you just need a plain replacement of string then why do you use regex?

You can try below code :

subs_filter http://mysite.example.com https://mysite.example.com i;
nginxsantos commented 10 years ago

I had a mistake in my reg expression. It is working now.

Thanks...