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

Amazon S3/CloudFront API edge purge #13

Open
cburschka opened this issue May 5, 2015 · 5 comments
Open

Amazon S3/CloudFront API edge purge #13

cburschka opened this issue May 5, 2015 · 5 comments

Comments

@cburschka
Copy link
Collaborator

Let's see how that works. Because waiting nearly an hour for the CDN cache to expire after the local content has already updated is bad. In the best case scenario, the local resources haven't changed significantly and your update is just delayed.
In the worst case, the new local files are incompatible with the old CDN resources, and you're left with a broken client until it updates. (I think this has happened before.)

@cburschka
Copy link
Collaborator Author

@cburschka
Copy link
Collaborator Author

It seems to work via a REST HTTP API. Since we're in a shell script, the easiest way to interact with it might be curl:

http://blog.scottlowe.org/2014/02/19/using-curl-to-interact-with-a-restful-api/

@cburschka
Copy link
Collaborator Author

Something like

curl \
  --request DELETE \
  --header "X-Auth-Token: <auth-token>" \
  --header "X-Purge-Email: <[email protected]>" \
  https://cdn.clouddrive.com/v1/<account-id>/<container>/<object>

(For security, the auth token should probably be read from a file that isn't hosted on github. :P )

@cburschka
Copy link
Collaborator Author

Eg.

CDN_AUTH=$(cat .cdn_auth)
CDN_MAIL=$(cat .cdn_mail)
curl \
  --request DELETE \
  --header "X-Auth-Token: $CDN_AUTH" \
  --header "X-Purge-Email: $CDN_MAIL" \
  https://cdn.clouddrive.com/v1/<account-id>/<container>/<object>

@sylae sylae changed the title # TODO: Rackspace Cloudfiles API edge purge # TODO: Amazon S3/CloudFront API edge purge Feb 23, 2016
@sylae
Copy link

sylae commented Feb 23, 2016

We're now using amazon s3/cloudfront for CDN over rackspace, however the aws cli does have an included feature (albeit experimental): http://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html

@sylae sylae changed the title # TODO: Amazon S3/CloudFront API edge purge Amazon S3/CloudFront API edge purge Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants