-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Ignore redirects when warming or invalidating static cache #7687
Conversation
|
The problem also appears when invalidating the static cache on entries that are redirects. This will lead to a Server Error right now. That’s why I applied |
@marijoo tests are failing, are you able to resolve those? |
Fixed the test case. ✌🏻 |
I'm not sure this is the behavior we want. The redirects that are failing - are they redirecting to an external site? |
Nope, all internal redirects. I wonder why Statamic would want to receive the http response for redirects? For me it seems reasonable to omit those by using |
I agree with @marijoo. I got a template where I redirect to a |
A 404, fine, but a regular redirect I'm not sure I understand. You'd want the final URL to be warmed too. |
I read this PR again, and I don't quite follow the reasoning either. I'd also expect Statamic to warm the redirects. Except 404. The only scenario I could see where you wouldn't want this behavior is when you redirect to a page, say |
I see the issue though. If an entry is a redirect, So I'm going to close this PR as it's not the correct approach. The real issue is that if an entry is a redirect, title: The Redirect
redirect: /final $entry->absoluteUrl(); // returns "/final", but should return http://site.com/final |
You are |
Looks like #7173 is handling this! |
Warming the cache via the
static:warm
command could result in some failing requests if there are redirect-only entries:Visiting 78 URLs... [✗] /a/redirect → cURL error 3: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for /a/redirect …
This PR fixes this issue by using
absoluteUrlWithoutRedirect()
instead ofabsoluteUrl()
when collecting entry URLs.