Is nginx sub_filter rewriting?

I am trying to rewrite the body links of a proxy page using something like this:

    sub_filter http://proxied.page.come http://local.page.com;
    sub_filter_once off;

Is this even the way to go? What is the difference between sub_filter module and substitutions_filter

Can a variable in delcaration sub_filter also be used?

+5
source share
2 answers

Ideally, you should ask the backend to write the correct links. Although you can fix some simple cases with a subfilter, this is not something at all possible (for example, if the returned data is not text, but, for example, a flash code).

sub_filter ( ), :

.

subs - , , , , . - , , .

+4

-. " ngx_http_sub_module - , , " ( )

nginx_substitutions_filter - , ,

, . :.

subs_filter_types text/css text/xml;
subs_filter http(s)?://(www.)?proxied.page.com/     http$1://$http_host/ r;
subs_filter http(s)?://(www.)?proxied2.page.com/    http$1://$http_host/ r;
+8

All Articles