Caching issue for next js application generating new file names

Hi,

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.

Please help!

Hey,

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.

Hey Thanks for the answer.
I used purge cache and that worked but I need a permanent solution. I do have some page rules for my domain see image.


I’ve seen people create a page rule to bypass the cache; is that something you recommend? If so how would I set that up for this path: https://meetbeagle.com/_next/static/*
?

Thanks!

Note that the cname meetbeagle.com point to a AWS ElasticBeanstalk host. the staging subdomain points to another ElasticBeanstalk host.

So, it is possible for you to create a page rule, to bypass the cache, you can do that:

  1. Create a new page rule at https://dash.cloudflare.com/?to=/:account/:zone/rules/form
  2. Insert the https://meetbeagle/com/_next/static/* into the path for the rule
  3. And in Then the settings are, you’d want to set Cache level to Bypass

Cool! It also asks me for the order, should did go first? Will that prevent my other page rules for the same domain to execute?

Also, why is it that my staging subdomain does not have this caching issue? Am I doing something wrong with my DNS configuration (note that meetbeagle.com CNAME is flattened).

Mainly I am trying to understand why this is happening only for the root domain meetbeagle.com and not staging.meetbeagle.com.

Sorry, I’m not sure :sweat_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.