Commit a83077e
authored
Fix:
`statamic:static:warm` attaches `--header` values to its main request pass:
```php
// requests(), line ~221
return new Request('GET', $uri, $headers);
```
but `warmPaginatedPages()` — which follows an index page's `X-Statamic-Pagination` header to warm pages 2..n — builds its requests without them:
```php
// warmPaginatedPages(), line ~136
$requests = $urls->map(fn (string $url) => new Request('GET', $url))->all();
```
So a warm run with `--header "X-My-Token: …"` identifies `/tags` to whatever is in front of the origin and does **not** identify `/tags?page=2`. Anything keyed on that header — a CDN/WAF skip rule, an origin allowlist, basic-auth-by-header on a staging site — applies to page 1 of every paginated URL and nothing else.
This is invisible until the thing in front of the origin starts acting on unidentified traffic, at which point every paginated page silently fails to cache while the command still reports success (the follow-up pool's rejections are printed, but see the second bug below, which makes them name the wrong URL).
In my case, on a site behind Cloudflare with a skip rule matching the warm's header: in a 15-hour window where bot protection was challenging automated traffic, the origin's own warm took 1,782 managed challenges against 4,191 skips — one client, one user-agent, split purely by whether a request was a pagination follow-up. Guzzle cannot pass a managed challenge, so none of those pages entered the cache.
### The fix
Parse the headers the same way the main pass does and pass them into the paginated requests.
### Notes
- No behaviour change for anyone not passing `--header`.statamic:static:warm drops --header values on paginated pages1 parent 59b5080 commit a83077e
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
0 commit comments