I have the page rule for my api:
api.mysite.com/fixture/*
Cache Level: Cache Everything, Edge Cache TTL: 2 hours
I deployed the index.html page with javascript code to Cloudflare page, here is how I call api inside html page:
<script>
getText();
async function getText() {
let myObject = await fetch("https://api.mysite.com/fixture/39202201",);
let myText = await myObject.text();
document.getElementById("demo").innerHTML = myText;
}
</script>
Caching works fine. Next, I go to Custom Purge and paste the url https://api.mysite.com/fixture/39202201
to clear the cache. And here is where the problem occurs, if I empty cache and hard reload https://mysite.com/index.html
page, it still returns me cached result but if I call api from postman, it returns me new (uncached) result.
What should I do to get uncached result from api when I open the page https://mysite.com/index.html
after the purge?