The question is why Caddy is not letting Transfer-Encoding: chunked
through from the response. Responses that are supposed to be streamed are not.
If we let the browser client send requests directly to the Nginx Ingress, the responses are working as expected, the response is chunked and the Transfer-Encoding: chunked
header is part of the response. And, the spinner that comes with that stream is rendered in the browser.
The Nginx has proxy_buffering: off
to make sure that streams are sent through immediately. And it clearly works.
But, when the browser sends requests via Caddy as a reverse proxy to Nginx, we do not get the Transfer-Encoding: chunked
at all and the response is not streamed (well, we do not get the chunks, so…).
It seems there is something missing between Nginx’s response and Caddy’s proxying.
We tried to run the NextJs client behind a local Caddy server, with a super simple reverse proxy
only, and then it worked. So it looks like there is a mismatch between Caddy proxying and Nginx streaming responses.
Here is another similar question, but with no reply.