Surge deployment, cache not purged

I am using Surge.sh to deploy our app, and CF to manage the DNS.

If I use the surge assigned subdomain (not using cf dns), the app is refreshed properly on redeploy.
But when I deploy to https://cache-test.my-domain.com (configured in cf dns), the js files are always loaded from memory in the browser (Status Code: 200 (from memory cache)) (Chrome)

I added ‘cache-test’ as a CNAME record (Proxied) to our regular acceptance domain on CF. The DNS settings seem to work, because I do see the app in the browser, and a ‘hard reload’ causes the modified js files to load.

I am using this deploy script

#!/bin/sh
set -o errexit

source ./.env-acceptance

echo '=> Deploying...'
./node_modules/.bin/surge dist --domain=${DEPLOY_DOMAIN}

echo '=> Purging Cloudflare cache...'
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
-H "X-Auth-Email: ${CLOUDFLARE_AUTH_EMAIL}" \
-H "X-Auth-Key: ${CLOUDFLARE_API_KEY}" \
-H "Content-Type: application/json" \
--data '{"files":["https://cache-test.my-domain.com/js/scripts.js"]}'

I have also tried with: --data '{"purge_everything":true}'

Also using the CF dashboard ‘Purge Cache’ -> ‘Custom Purge’ did not work.

I must be missing something.

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