Skip to content

Commit 95a6f35

Browse files
authored
purge: Fix CDN purge script (enable purgeAllDynamic option)
While not yet documented or announced, it seems the Purge API from StackPath/Highwinds/StrikeTracker no longer purges variants by default as of last month. The old behaviour can be regained through the undocumented `purgeAllDynamic` boolean option which appears to be false by default. I'm not sure what variants we have that cause this behaviour, but it might be due to something like Vary:Accepted-Encoding (gzip etc.). Fixes #45. Closes #48.
1 parent 511a8cd commit 95a6f35

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

purge.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
// The StrikeTracker Purge API is protocol-sensitive.
3939
// HTTP and HTTPS need to be purged separately, or
40-
// we can use a protocol-relative file url, which HW
40+
// we can use a protocol-relative file url, which Highwinds
4141
// supports as short-cut for purging both.
4242
$file = "//{$hwConfig->file_hostname}/" . ltrim( $_SERVER[ 'REQUEST_URI' ], '/' );
4343

@@ -73,10 +73,10 @@ function jq_request_post_json( $url, array $headers, array $postData ) {
7373
"Authorization: Bearer {$hwConfig->api_token}",
7474
"Content-Type: application/json",
7575
),
76-
// post body (JSON)
76+
// post body (will be encoded as JSON)
7777
array(
7878
'list' => array(
79-
array( 'url' => $file ),
79+
array( 'url' => $file, 'purgeAllDynamic' => true ),
8080
),
8181
)
8282
);

0 commit comments

Comments
 (0)