Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/purge-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ jobs:
- name: Purge ${{ env.KEY }}
run: |
curl -fsS -X POST \
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge/${{ env.KEY }}" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}"
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \
-H "Surrogate-Key: ${{ env.KEY }}"
Comment on lines +27 to +29
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow now POSTs to /service/${FASTLY_SERVICE_ID}/purge with a Surrogate-Key request header and no body. Elsewhere in this repo, surrogate-key purging is implemented as a POST to /service/{service_id}/purge/{key} (see fastly/utils.py:44-48), so this change likely breaks purging (or at least makes it inconsistent with the app’s purge behavior). Recommend switching back to the /purge/${KEY} endpoint, or if you intend to use the multi-key purge endpoint, send the expected JSON payload and required headers (e.g., content-type) instead of only Surrogate-Key.

Suggested change
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \
-H "Surrogate-Key: ${{ env.KEY }}"
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge/${{ env.KEY }}" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}"

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +29

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Put surrogate key back into the Fastly purge endpoint

The workflow now posts to .../service/{id}/purge and sends the key only via Surrogate-Key header, but Fastly surrogate-key purging expects the target key to be part of the purge-by-key request path; with curl -f this causes the step to fail on every push/dispatch and prevents cache invalidation for the selected target.

Useful? React with 👍 / 👎.