How to stop the caching for some JS file from APO?

Is it possible to bypass some JS files from the APO feature? I have the same following issue that the user has to manually refresh the page after logging in.

I tested it, the issue is solved if bypass a whole page. However, it means that I have to stop using the APO. The current Page Rules don’t support the file layer to bypass the specified files that I don’t want them to be cached.

Do any guys know how to stop caching on some files from the APO?

After reading the post in your link, it made me think that the browser is caching the resources.

I’m not sure what you mean by this. If it’s a JS file, can’t you just add a Page Rule to bypass cache for the URL of that JS file?

I think it is not from caching of browser! I tested it to disable APO feature then all is going fine without that issue.

I tried but there is no different when bypassing the JS files in Page Rules. However, it is working when I bypass the whole page in Page Rules.

That’s quite strange, then. Cloudflare caches by URL, so bypassing cache for the page URL should have no impact on a JS file. Unless the JS is embedded in the page itself, or the page generates a special URL for the JS.

Can you post the URL of the page this is happening, as well as the URL of the JS file?

You can check the above page and other blog posts. And try to comment with your social accounts (Twitter and Google) but Facebook no this issue. You have to manually refresh the page after logging in.

The following rule is working:
*.iupilon.com/can-i-microwave-a-chinese-food-container/*

But it is not working when I am trying to bypass the JS files only:

*.iupilon.com/wp-content/plugins/wpdiscuz/assets/js/wpdiscuz-social.js
*.iupilon.com/wp-content/plugins/wpdiscuz/assets/js/wpdiscuz.js

Try getting rid of the *. at the beginning.

Your canonical URL begins with iupilon, but your page rule is wildcardDOT. It will only match anything with a dot before iupilon.

Tried as well even the following rules:

*iupilon.com/wp-content/plugins/wpdiscuz/assets/js/wpdiscuz-social.js
*iupilon.com/wp-content/plugins/wpdiscuz/assets/js/wpdiscuz.js
iupilon.com/wp-content/plugins/wpdiscuz/assets/js/wpdiscuz-social.js
iupilon.com/wp-content/plugins/wpdiscuz/assets/js/wpdiscuz.js
*iupilon.com/wp-content/plugins/*

wpdiscuz-social.js is showing a cache HIT.

Can you post a screenshot of all your Page Rules?

I tested it and find it is no different then turn it off.

If it’s off, then I can’t test it.

Can you confirm that the Name Servers at the bottom of your DNS page are Daisy and Elliot?

It is on now.
And the Name servers are daisy.ns.cloudflare.com and elliot.ns.cloudflare.com

The bypass is working: DYNAMIC

1 Like

Any tool that can help to find out which file that I have to bypass?

Also, will the following rule that is bypassing cookies as well?
*iupilon.com/*
The above rule is working to the situation. However, it means that I have to give up all caching!

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