Can Apache/nginx gzip server response if it's already chunked?

戏子无情 提交于 2019-12-11 05:28:47

问题


I have a server REST API that answer some JSON response. I want to chunk it on the server to increase response time.

Is there a way for a reverse proxy like Apache or Nginx or any other, to intercept this response, and gzip the chunks, and send it back to the client as chunked?

I got something working by gzipping the content before chunking it directly inside my API server, and I'm just wondering if there's any other option available to me that would increase response time of my server.


回答1:


I think that this is possible according to some other stack overflow questions that I have seen answered.

https://serverfault.com/questions/159313/enabling-nginx-chunked-transfer-encoding/187573#187573

According to the above, it is possible to disable proxy_buffering in your nginx configuration, and supports gzipping output if configured.

As noted in the page, there are possible disadvantages and you should test to ensure that this action is appropriate.



来源:https://stackoverflow.com/questions/40889079/can-apache-nginx-gzip-server-response-if-its-already-chunked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!