Question about proxy

Saint Michael venefax at gmail.com
Tue Jan 31 03:39:52 UTC 2023


Can you please elaborate on this:
"You probably want subs_filter_types to include text/html, and you probably
want "r" on the subs_filter patterns that are regular expressions rather
than fixed strings"
one example will suffice.


On Mon, Jan 30, 2023 at 8:20 PM Francis Daly <francis at daoine.org> wrote:
>
> On Sun, Jan 29, 2023 at 03:17:15PM -0500, Saint Michael wrote:
>
> Hi there,
>
> > What causes each case, i.e., what do I need to do so always the
> > https://domain.com is NOT the original domain being proxied, but my
> > own domain (https://disney.ibm.com).
>
> You seem to be using the module at
> https://github.com/yaoweibin/ngx_http_substitutions_filter_module.
>
> You probably want subs_filter_types to include text/html, and you probably
> want "r" on the subs_filter patterns that are regular expressions rather
> than fixed strings.
>
> Generally, you proxy_pass to a server you control, so it may be easier
> to adjust the upstream so that subs_filter is not needed. But basically:
> you want any string in the response that the browser will interpret as
> a url, to be on your server not on the upstream one.
>
> So in this case, you can test the output of things like "curl -i
> https://disney.ibm.com/something", and see that it does not contain any
> unexpected mention of perplexity.ai.
>
> > subs_filter_types text/css text/javascript application/javascript;
> > subs_filter "https://cdn*.perplexity.ai/(.*)"
> > "https://disney.ibm.com/cdn*/$1" gi
> > subs_filter "https://perplexity.ai/(.*)" "https://disney.ibm.com/$1" gi;
> > subs_filter "https://(.*).perplexity.ai/(.*)" "https://disney.ibm.com/$1/$2" gi;
> > subs_filter "https://www.perplexity.ai" "https://disney.ibm.com" gi;
> > subs_filter "https://perplexity.ai" "https://disney.ibm.com" gi;
> > subs_filter "perplexity.ai" "disney.ibm.com" gi;
>
> If you do see an unexpected mention, you can try to see why it is there
> -- especially the first subs_filter above, I'm not certain what it
> is trying to do; and the second one probably does not need the regex
> parts at all -- the fifth and sixth ones probably both do the same
> thing as it. The third and fourth seem to have different ideas of how
> "https://www.perplexity.ai/something" should be substituted; maybe you
> have a test case which shows why both are needed.
>
> Good luck with it,
>
>         f
> --
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx


More information about the nginx mailing list