proxy_pass using ngx.location.capture - Not able to process the response

216 views
Skip to first unread message

rahul0...@gmail.com

unread,
Aug 23, 2013, 5:32:09 PM8/23/13
to openre...@googlegroups.com
Hello Guys,

Response:

{"status":200,"body":"\u001f‹\b\u0000\u0000\u0000\u0000\u0000\u0000\u0003]Q]oÔ0\u0010ü+&Rî%\\ü\u0015ÇI¥\u0013j+ÑJmy\u0001Ô\u0017¤“ÏÞpËå’à8pmá¿cs\b!ü`{Ö³»ãÙ—Ìöh\u000fÛÅ÷Ù\u0005Éö!L\u0017”\u001aWš\/Ø÷8\u000eGs*íx¤Á›®CK ¨ \u0004§ÕÎòJÖ¬eNKÍ;i*×UVÓŠ6JQ©™¦œÚŠ©NÖ•\u0016ÌUªÑÆZ¡\u001a¾³ÆêZs¹\u0016ZÐ7Q\u0002\f\u0001§ à¢TM)”,k½:‡\u0017³y\u0018Ÿ£\u0018“‹·ªdE.š{\u001c–S.¯Š i»\u001cœ\u001fÑ\u0015¢”\t°^æ\\´Åå4õð\b»;\f1µmÛ\\\\¥ì»Û\u000f\u000f÷¹¸.z<@q\u0003ö0&ú{Ó\u0019 gfÙ®ìŒÏ°Ñ¢9µleÑEqJ³ì5ɦãè Ù%\u0012ðh!ÞYÉ\u007fÃÞX8ÆßlÑÅh´\"rö€Ÿ÷!–EäM8'0&ÿ[Š7Ñ8Å*Ϊȴ\u001eLÀo°u8O½yŠ\u0015²9Ä M2þ¾þ™Ýc\u001a˜9’Ûx’k3ã0þ¸ @>-Œ\u0019É\u0019é<\u0000Y“w#q0 3\u0006âáë‚\u001eÜ«To^¬…yŽM‚_àß\u0006áiJг\u0000§ ˜ßÑ…}\fDs\"\u0002ïGŸž³Ÿ¿\u0000õ\u0003ÿ³N\u0002\u0000\u0000","header":{"Content-Length":436,"Set-Cookie":"definitiad_campaign_3338=3; Path=\/","Vary":"Cookie","Content-Encoding":"gzip","Content-Type":"application\/json","X-Frame-Options":"SAMEORIGIN"},"truncated":false}

The "body" response looks like some encoded response. I am not able to process this response. In apache response comes in proper format.

Please help me process this response. It might be the compression issue. If thats the issue then how to decompress it.

Waiting doe your reply.

Yichun Zhang (agentzh)

unread,
Aug 23, 2013, 9:46:24 PM8/23/13
to openresty-en
Hello!

On Fri, Aug 23, 2013 at 2:32 PM, rahul007true wrote:
[...]
> \u0003ÿ³N\u0002\u0000\u0000","header":{"Content-Length":436,"Set-Cookie":"definitiad_campaign_3338=3;
> Path=\/","Vary":"Cookie","Content-Encoding":"gzip","Content-Type":"application\/json","X-Frame-Options":"SAMEORIGIN"},"truncated":false}
>

Note the "Content-Encoding":"gzip" header above. And yes, your
subrequest response is gzip compressed.

> The "body" response looks like some encoded response. I am not able to
> process this response. In apache response comes in proper format.
>
> Please help me process this response. It might be the compression issue. If
> thats the issue then how to decompress it.
>

You can either de-compress the response body yourself in Lua, or just
disable the backend gzip compression by adding a configuration
directive like below to your location configured by ngx_proxy
(assuming you're using ngx_proxy because you didn't mention it):

proxy_set_header Accept-Encoding "";

See the following GitHub ticket for more details on these two approaches:

https://github.com/chaoslawful/lua-nginx-module/issues/12

Best regards,
-agentzh

avi...@adallom.com

unread,
Sep 3, 2013, 7:52:41 AM9/3/13
to openre...@googlegroups.com
Hello!

You can also using the Gunzip filter module.
I think simply adding "gunzip on;" to the section that contains the "proxy_pass" directive, and this will solve the issue.

Cheers,
Aviram
Reply all
Reply to author
Forward
0 new messages