Php coupon generator does not work due to automatic cloudflare caching

We have a php coupon generator at nj-massage-coupon.njmassage.info, and i have tried bypassing this page from caching with a page rule and a cache rule, and neither seems to work. It is supposed to generate a new coupon every ten minutes and display a different graphic once it changes. However, the coupon does not generate properly. When I deactivate Cloudflare on the site, the coupon generator works.

So I presumably I need to make a rule to bypass caching for this one subdomain, but it is not working properly when I put in a page rule or a cache rule. I have also tried the suggestion here Cloudflare page rules wildcard cache bypass not working and that didnt work either. Any help would be appreciated. Thank you.

May I ask you to share a screenshot of the Page Rule and Cache Rule? :thinking:
Also, is it the only rule on the list or you’ve got more rules there?

May I ask you to check out what option have you got selected by navigating to the Cloudflare dashboard → Caching → Configuration → find section “Browser Cache TTL” and make sure the selected option from the dropdown menu is “Respect Existing Headers”.

Furthermore, from the same menu, click on the blue button saying “Purge Everything” to flush the cache at Cloudflare Edge, just in case.

Wait for a minute or two.

Refresh a page in your Web browser, otherwise try clearing your Web browser cache or use a different Web browser to test out again.

Furthermore, may I ask how does it work?
Is it an image, or is it some kind of a textual code or?

So it is an image from my above question, correct?
Could you share the URL address to the specific resource?
Does the name change or just the picture gets overwritten? :thinking:

By default, images are cached at Cloudflare.
As far as I can think of and see, cf-cache-status: HIT is presented for images.
Furthermore, x-turbo-charged-by: LiteSpeed also cache at your origin host.

You could give it a try by using Transform Rules, if everything fails unexpectedly.

Navigate to the Cloudflare Dashboard → Rules - > Transform Rules → Modify Response Header → Select “Custom filter expression” and add your Image URL (name, or part of it) for the URI Path.

Therefrom, add 3x “Set static” kind of type with the values:

  1. Cache-Control max-age=0, no-cache, no-store, must-revalidate
  2. Expires Wed, 12 Jan 1980 05:00:00 GMT
  3. Pragma no-cache

Screenshot for help:

Helpful step-by-step docs: