404 cache Problem on JS file

Hi, thank you for joining this topic. I face the problem about cloudflare caching 404 page.

I am developing frontend site and deployed, but cloudflare set some paths to be 404 and cached them eventhough I never access to that path before. The pattern of those path are like this.

https://wespace-cudson-qc.edvisory.co.th/_nuxt/8000f2b.js
https://wespace-cudson-qc.edvisory.co.th/_nuxt/76aba84.js

You may try refreshing the link above. Sometimes it will response 404 and then 200, 404, …

I tried many ways and that related to this topic How to avoid caching 404

The way I tried to set

  • Enable developer mode
  • Set Page rule to set “Cache Level” as “Bypass” for any path of .edvisory.co.th/
  • Purge the cache for everything
  • Disable Cloudflare’s Proxied for that name wespace-cudson-qc
  • Wait for 3 minutes, 3 hours, 1 day…

Then I still have no luck, the problem still persist. you may check the stat here.

http://sitemeer.com/#https://wespace-cudson-qc.edvisory.co.th/_nuxt/7013bb9.js

Please, anyone.

Thank you so much.

I’m not sure what you mean by this. Cloudflare doesn’t return 404s. Those come from the origin.

Would you mind posting a screenshot of your DNS records? It’s ok if you black out IP addresses.

1 Like

Cloudflare return 404 which is not correct, the origin never return 404 (for specific link).

You may try access this link and refresh many times. https://wespace-cudson-qc.edvisory.co.th/_nuxt/8000f2b.js

Capture3

Capture4

Thank you for reply.

Does the Nuxt always re-generate a file from the start for each request?

If so, while having Bypass, can you configure your origin to cache or set the expires for that .js files for a day for example? Does anything changes?

The path and rewrites, if so, for the _nuxt files is correctly set at your origin?
Which Web server are you using?

How about the routes and path for a setup you are using?

I see the difference:
a) when Developer Console in my Web browser is viewable (toggled) and the Disable cache option checked, when I hit refresh (F5) each time the resource is loaded fine (HTTP 200)

cf-cache-status: REVALIDATED
cach-control: no-cache

b) As soon as I close the Developer Console, hit refresh (F5), every 2nd time I got 404 not found.

c) As soon as I disable cache option - uncheck but keep the Develper console toggled, hit refresh (F5), again 404 pops-up

cf-cache-status: EXPIRED

Suspicious to me (not experienced them before):

access-control-expose-headers: WWW-Authenticate,Server-Authorization
vary: origin,accept-encoding

As if the file is “served” from local cache of my Web browser, it fails (404 not found) every 2nd time.

Do you see any errors log output in your console for the requests you/we made for the specific files, when you start your Nuxt app? How about running it with the debug/verbose mode?

Could this be somehow also related to:

2 Likes

cloudflare set some paths to be 404…

I mean for the path

https://wespace-cudson-qc.edvisory.co.th/ - works as expect
https://wespace-cudson-qc.edvisory.co.th/_nuxt/**.js - works unreliably

I still say no:
4xx Client Error – Cloudflare Help Center

Cloudflare does not generate 404s for customer websites, we only proxy the request from the origin server. When seeing a 404 for your Cloudflare powered site you should contact your hosting provider for help.

1 Like

I resolved it now.

I don’t know the root cause. The problem comes from Kubernetes networking layer.

I delete workload and recreate it. Firstly the workload come from my CI pipeline, I’m not sure which layer is the root cause.

But it solved them all. Cloudflare always works as expected. Never happend unreliable situation.

Thank you, sdayman, fritexvz.

3 Likes

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