CloudFlare cache makes NextJS App Router return raw JSONs

Hi,

I use NextJS app with App Router (Server Components). I deployed the app on fly.io and proxied it thru nginx (deployed as another fly.io app).

When I hard refresh pages, the app returns raw JSONs. From JSONs content I’m guessing it’s server components internal messaging/serialized props. I ran my nginx container locally and everything worked correctly. Everything also works when I bypass Cloudflare cache, so I think CF cache is somehow causing the problem. For now I’m bypassing cache but ofc it is not an ideal solution.

Do you have any ideas?