Can Apache/nginx gzip server response if it's

2019-08-03 00:37发布

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条回答
smile是对你的礼貌
2楼-- · 2019-08-03 01:10

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.

查看更多
登录 后发表回答