I am having issues where cloudflare is caching some file generated by Next.js webpack example: /_next/static/chunks/80e1a3c5e5acad0e4b55db905a0514a63d04ef99.77ce925714c8a2ae541d.js
These files are generated whenever there is a code change in the project and so when cloudflare serves old files resulting in 404.
The strange thing is that this is only happening on my root domain and not my subdomain.
I think your issue can be solved by using the “Purge Cache” function. You can find this button on the main dashboard of any zone. If you’re successively pushing new code to your website, I’d recommend enabling “Development Mode” whilst you’re doing so, this can also be found on the dashboard page for a zone.
As for your problems about not caching on subdomains, it could either be Cloudflare doing something, or you have something configured that’s preventing it from caching on the subdomain, such as a Page Rule or an i proxies DNS record. It’ll probably require more information to see what’s going on.