Welcome! Log In Create A New Profile

Advanced

Re: sub_filter not working on JSON file

Maxim Dounin
August 02, 2018 11:12AM
Hello!

On Thu, Aug 02, 2018 at 01:46:35PM +0000, Friscia, Michael wrote:

> I’m trying to figure out why my sub_filter is not working on a
> JSON file. I do have application/json and text/json listed in
> the sub_filter_types but the simple string replace is not
> happening. It causes me to think that for whatever reason, Nginx
> is not seeing this file as JSON. Is there a way to output what
> mime type the file from the upstream server is so I can make
> sure I have the right filter type?
>
> Or, is there something I should also be doing to make the
> sub_filter work on a JSON file?

Some things to check, in no particular order:

- The Content-Type header as sent by the upstream server is
correct. Check the response headers in your favorite client to
see the Content-Type header (you can also log
$sent_http_content_type or $upstream_http_content_type, but
usually checking response headers is enough).

- The Content-Type in question is listed in the sub_filter_types
directive.

- The response is not compressed by the upstream server. If it
is, consider adding `proxy_set_header Accept-Encoding "";` to
the configuration.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

sub_filter not working on JSON file

wickedhangover August 02, 2018 09:48AM

Re: sub_filter not working on JSON file

Dmitry Volyntsev August 02, 2018 09:52AM

Re: sub_filter not working on JSON file

wickedhangover August 02, 2018 10:12AM

Re: sub_filter not working on JSON file

Maxim Dounin August 02, 2018 11:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready