Why after purge_cache , the data keep old when with origin

By default the origin header is included in the cache key of an asset, so each different origin header is effectively a “different” asset that needs to be purged. See Cache Keys · Cloudflare Cache (CDN) docs for what’s included in the default cache key.

Now when doing single file purge, you need to include the origin header that you want to purge, otherwise you will only purge the asset that doesn’t have an origin header set.

To purge the origin header you want in your example, you can send a purge by url via api with the following body:

{
    "files": [
        {
            "url": "https://ok0.pw/v",
            "headers": {
                "Origin": "https://xxai.art"
            }
        }
    ]
}

If you have multiple origin headers, you would do something like:

{
    "files": [
        {
            "url": "https://ok0.pw/v",
            "headers": {
                "Origin": "https://xxai.art"
            }
        },
        {
            "url": "https://ok0.pw/v",
            "headers": {
                "Origin": "https://somethingelse.art"
            }
        }
    ]
}

purge everything works because you are telling cloudflare to purge all assets so whether the asset was cached with 10 different origin headers or 1, it doesn’t matter.

1 Like