Forum: NGINX Re: http_sub_module, need help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
nbubingo (Guest)
on 2009-01-09 09:12
(Received via mailing list)
The http_sub_filter_module can substitue one string to another.
Sometimes it dosen't work because of gzip. If the HTTP packets come from
backend and the client's HTTP request header comes with
"Content-Encoding:gzip", then the entire packets is compressed.
Maybe you can set like this: ¡°proxy_set_header Accept-Encoding '';¡° ,
but any response will not compressed any more.

------------------
YaoWeibin
2009-01-09

-------------------------------------------------------------
·¢¼þÈË£ºraptium
·¢ËÍÈÕÆÚ£º2009-01-09 13:52:15
ÊÕ¼þÈË£ºnginx
³­ËÍ£º
Ö÷Ì⣺http_sub_module, need help

I am using nginx as a reverse proxy for IBM Lotus Domino Web Mail.
Since there are some internal only URL in email content, I need
http_sub_module to modify(add some prefix ) the URL so that user
outside intranet can click the link and access through another portal.

I add

   sub_filter aaa bbb;
   sub_filter_types application/json application/x-javascript;
   sub_filter_once off;

into the nginx.conf and it does not work.'aaa' is not replaced by 'bbb'

However, if I save the web page as html file or generate some json
which contains 'aaa'. It can be replace by 'bbb'.

Therefore, it there any other options besides `Content-Type` can
prevent http_sub_module replacing the word?

Sorry for my bad English...
Merlin (Guest)
on 2009-01-09 11:13
(Received via mailing list)
If I am reading you correctly, this might be more appropriately doable
with
the proxy_redirect directive of the proxy module instead.  Check out the
documentation here and give iit a try:
http://wiki.codemongers.com/NginxHttpProxyModule#p...
raptium (Guest)
on 2009-01-09 11:54
(Received via mailing list)
Thanks~ nbubingo & Merlin

In fact, the URLs which I want to modify are in the http BODY. The
original links look like 'http://somelocalhost/foo/bar.html' and I
hope it be changed to
'https://webproxy.mycompany.com/http://somelocalhos....

Therefore, nbubingo's solution works for me. :-)
nbubingo (Guest)
on 2009-01-09 12:30
(Received via mailing list)
Forgive my poor english, I mean the request header may let backend
server compressed the response first. Then nginx can't  substitute
string in the compressed response.

------------------
YaoWeibin
2009-01-09

-------------------------------------------------------------
From£ºMerlin
Date£º2009-01-09 17:09:52
To£ºnginx
CC£º
Subject£ºRe: http_sub_module, need help

If I am reading you correctly, this might be more appropriately doable
with
the proxy_redirect directive of the proxy module instead.  Check out the
documentation here and give iit a try:
http://wiki.codemongers.com/NginxHttpProxyModule#p...
This topic is locked and can not be replied to.