Skip to content

Commit 32f06f6

Browse files
committed
Merge pull request alphagov#51 from alphagov/add-assets-hostname-to-fastly-purge
Include the assets hostname when purging from the CDN
2 parents f44435e + 38ae7cb commit 32f06f6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cdn.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from fabric.api import *
2-
import cache
32

43
@task
54
@runs_once
65
@roles('class-cache')
76
def fastly_purge(*args):
87
"Purge items from Fastly, eg \"/one,/two,/three\""
9-
for path in args:
10-
run("curl -s -X PURGE -H 'Host: www.gov.uk' http://www-gov-uk.map.fastly.net%s" % path.strip())
8+
govuk_fastly = 'http://www-gov-uk.map.fastly.net'
9+
hostnames_to_purge = ['www.gov.uk', 'assets.digital.cabinet-office.gov.uk']
10+
for govuk_path in args:
11+
for hostname in hostnames_to_purge:
12+
run("curl -s -X PURGE -H 'Host: {0}' {1}{2}".format(hostname, govuk_fastly, govuk_path.strip()))

0 commit comments

Comments
 (0)