Welcome! Log In Create A New Profile

Advanced

Re: problem with echo_before when proxying a server which sends gzipped content

Maxim Dounin
April 02, 2014 09:48AM
Hello!

On Wed, Apr 02, 2014 at 02:48:33PM +0200, Carsten Germer wrote:

> Hi everyone,
> currently I'm, trying to configure NGINX as a proxy for JSON
> from the iTunes API.
> It's for a small game, iTunes is slow sometimes and the data for
> the game is mostly the same for a good length of time, anyway.
> The JSON from iTunes is to be padded with the original requests
> callback parameters. For this there are many good posts out on
> the net, but I can't seem to get the basic echo_* to work.
>
> I boiled my configuration of nginx down to the point where I
> just use echo_before or echo_after and proxy_pass.
>
> If I append something with echo_after it works fine in browsers
> and in jQuery.
> If I prepend anything with echo_before the answer can't be read
> by browsers, "curl --compressed" throws "curl: (23) Error while
> processing content unencoding: invalid block type".
>
> If I configure Firefox with "about:config" to
> "network.http.accept-encoding:true" it fixes fixes display in
> Firefox.
>
> When I look in the network tab of chrome console I see that
> requesting ".../echo-after/" closes the request after 2Xms.
> Requesting ".../echo-before" also gets 200 ok but never arrives
> fully, is shown as "pending" indefinitely.
>
> My best bet is, that it has something to do with gzip-compressed
> answer from iTunes but I can't find any solution or even hint
> for my level of understanding of the inner workings of nginx.

Something like

proxy_set_header Accept-Encoding "";

in relevant location should help.

BTW, you may try add_before_body / add_after_body as available in
standard addition filter module instead, see here:

http://nginx.org/en/docs/http/ngx_http_addition_module.html

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

problem with echo_before when proxying a server which sends gzipped content

Carsten Germer April 02, 2014 08:50AM

Re: problem with echo_before when proxying a server which sends gzipped content

Maxim Dounin April 02, 2014 09:48AM

Re: problem with echo_before when proxying a server which sends gzipped content

Carsten Germer April 03, 2014 11:16AM

Re: problem with echo_before when proxying a server which sends gzipped content

Yichun Zhang (agentzh) April 29, 2014 03:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
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