-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Feature Request: Automatic format conversion based on user-agent #253
Comments
I do this in layers in front of imaginary to keep it "intentionally stupid". Part 1 is using |
I see several complications with this approach, for those who are using a CDN. Content-Negotiation can make for a terrible cache strategy (even the order of the Accept header will result in many cache-misses) or terrible cache handling (Serving webp because it was requested first and leaving every other browser after that with an unsupported image). However I can understand that there are situations where this would be beneficial especially when the content-negotiation can be done properly. HTTP has a pretty neat thing for content-negotiation, the HTTP Accept header. The User-Agent isn't ideal. This would be a rather simple change:
PR welcome. |
You shouldn't create a cache key blindly. It took me a while to get this right, but it serves me very well and I account for a few things based on either client hints via headers or polyfilled as cookies. |
Try "Vary: accept" |
How about support for automatic format conversion based on user agent. Webp seems to be the preferred format on supported browsers like chrome. So, wouldn't it be nice to have an option which enables the automatic format conversion based on user-agent (browser)
The text was updated successfully, but these errors were encountered: