Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The generate URL, e.g. http://example.com/image/generate/thumbnail/sites/default/files/pictures..., returns the proper image but with a 500 Internal Server Error HTTP status code. This is because the image module does not use the updated header format that was introduced in #147310: Implement better cache headers for reverse proxies.
This patch fixes that. It also adds proper HTTP status codes when the generated image cannot be returned.
Comment | File | Size | Author |
---|---|---|---|
#3 | image-headers-2.patch | 9.88 KB | c960657 |
image-headers-1.patch | 9.62 KB | c960657 | |
Comments
Comment #1
Dries CreditAttribution: Dries commentedExcellent patch -- this looks good to me. My only reservation was that 10 seconds feels long but that is really minor as this code shouldn't trigger that often.
Comment #2
webchickHm. I think we could probably move this down to more like 2 or 3 seconds at the most. Then it wouldn't appear like an error to someone browsing the site.
The expanded tests look really helpful.
@c960657, was there a particular reason why 10 was chosen?
Comment #3
c960657 CreditAttribution: c960657 commentedThe 10 seconds was chosen on an assumption that after that long the image generation is (almost) definitely done. But I guess the client can just try several times, if for some reason the generation takes very long. I changed it to 2.
I doubt any browsers actually request the image again after the specified time, but some web spiders may support the header. I just added a note about this, so that people reading the code wont expect too much.
Comment #4
quicksketchThis looks good to me, I didn't know we'd fixed the headers. A significant improvement!
Comment #5
Dries CreditAttribution: Dries commentedI fixed a typo, and committed this to CVS HEAD. Thanks again, c960657!