Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #782: Invalidate CDN on bundle upload #803

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leplatrem
Copy link
Contributor

@leplatrem leplatrem commented Mar 19, 2025

Fix #782

This code will become obsolete if we change of CDN provider

@leplatrem
Copy link
Contributor Author

With other providers...

import requests

FASTLY_API_KEY = "your-fastly-api-key"  # Replace with your API key
FASTLY_SERVICE_ID = "your-service-id"   # Replace with your Fastly service ID
URL_TO_PURGE = "https://yourdomain.com/path/to/file"

def purge_fastly_url(url):
    headers = {
        "Fastly-Key": FASTLY_API_KEY,
        "Accept": "application/json"
    }
    
    purge_url = f"[https://api.fastly.com/purge/{url}](https://api.fastly.com/purge/%7Burl%7D)"
    response = requests.post(purge_url, headers=headers)

    if response.status_code == 200:
        print(f"Successfully purged: {url}")
    else:
        print(f"Failed to purge. Status: {response.status_code}, Response: {response.text}")

# Run purge
purge_fastly_url(URL_TO_PURGE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caching issue for startup bundle
1 participant