Heroku CLI Plugin for interacting with Fastly CDN
Last updated 4 months ago by psbanka .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @fastly/heroku-plugin 
SYNC missed versions from official npm registry.

Heroku Fastly Plugin

Heroku CLI plugin for interacting with fastly configuration.


Install the heroku-fastly plugin using the heroku plugins command. More details are available in Heroku's Devcenter.

heroku plugins:install @fastly/heroku-plugin


The CLI Plugin includes the commands: tls, verify, and purge.

TLS and Verify

To add TLS to a domain your pricing plan must include a TLS domain and the domain must be configured in the active version of your Fastly Service. The process involves creating the TLS Domain, verifying ownership of your domain, and checking the verification status of your domain. Usage:

heroku fastly:tls DOMAIN [VERIFICATION_TYPE]

To add TLS/SSL to a custom domain:

heroku fastly:tls www.example.org --app my-fast-app

Create a DNS TXT record with the verification string output from this command.

heroku fastly:verify start www.example.org --app my-fast-app

Verfies ownership of the domain via the DNS TXT record added from output of the previous command.

heroku fastly:verify status www.example.org --app my-fast-app

Checks the status of the verification process. If complete, a new CNAME will be output that you can update to after the new certificate propagates to all caches.

To remove TLS/SSL from a custom domain, include the the -d flag:

heroku fastly:tls -d www.example.org --app my-fast-app


Issue a surrogate key purge or purge all. For reference, see the Purge API docs. Usage:

heroku fastly:purge [KEY]

To purge the entire cache:

heroku fastly:purge --all --app my-fast-app

To purge a surrogate-key from the cache:

heroku fastly:purge my-surrogate-key --app my-fast-app

To softpurge a key from the cache:

heroku fastly:purge my-surrogate-key --soft --app my-fast-app


Clone the repo and run npm install to install dependencies.

Further detail on building Heroku CLI plugins is available in the devcenter.

  • Clone this repo.
  • cd into heroku-fastly repo
  • Run npm install.
  • Run heroku plugins:link.
  • You can make sure this is working by running heroku plugins, will return something like:
heroku-fastly 1.0.7 (link) /Users/your-path/heroku-fastly
  • Test tls command. Run heroku fastly:tls www.example.org --app my-fast-app. This command will return something like:
=== Domain www.example.org has been queued for TLS certificate addition. This may take a few minutes.
 ▸    In the mean time, start the domain verification process by creating a DNS TXT record containing the following content:
 ▸    Once you have added this TXT record you can start the verification process by running:
 ▸    $ heroku fastly:verify start DOMAIN —app APP
  • Test verify command. Run heroku fastly:verify start www.example.org --app my-fast-app, will return something like:
 ▸    Valid approval domains: example.org, www.example.org
Type the approval domain to use (or ENTER if only 1): : ^C
  • Test purge command. Run heroku fastly:purge --all --app my-fast-app, will return something like:
{ status: 'ok' }


Tests can be run with npm test.


  • We follow Semantic versioning with regards to the version of this plugin. Any pull-requests to this project must include an appropriate change to the package.json file (as well as the package-lock.json file) and the CHANGELOG.md file.

  • After any PR has been merged, run an npm publish command from the master branch after pulling all changes in from github.

Contact us

Have an issue? Please send an email to support@fastly.com.


Want to see new functionality? Please open a pull request.

Current Tags

  • 2.0.2                                ...           latest (4 months ago)

3 Versions

  • 2.0.2                                ...           4 months ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |