Non-Existent Images serving Placeholder Image return 200 Status instead of 404 Status affecting CDNs/Edge Servers/Browser Cache #39174
Labels
Issue: ready for confirmation
Reported on 2.4.7-p2
Indicates original Magento version for the Issue report.
Preconditions and environment
M2 2.4.7-p2
Add assets for default placeholder images.
Set through configuration/admin panel.
Ensure placeholders are used if image does not exist.
Steps to reproduce
make a request for a bogus image path you know will fail and return placeholder image
Expected result
Placeholder response and 404 status code
edge caches/image cdns/browsers/etc are caching image correctly based on 404 status code resulting in an extremely short cache expiration time set and for image delivery networks the master image source is not considered set.
Actual result
Placeholder response and 200 status code
edge caches/image cdns/browsers/etc are caching placeholder image incorrectly based on 200 status code resulting in (usually) very long cache expiration times set and for image delivery networks the master image source is now considered set.
Additional information
A 404 status code should be set when an image request is not found, but response is sent using placeholder data.
Live Example:
curl https://i4.ytimg.com -i
You will see response code is 404, but browser still utilizes response data to render the image based on standards. https://html.spec.whatwg.org/#images-processing-model
I believe S2 status is warranted since these are 404 placeholders, ie non-critical, and we have to employ a workaround to ensure we are not incurring extra costs from our CDNs (ie monitor and purge master source assets in CDNs being created from fake 200 placeholder responses).
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: