You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ATS will send image/webp content to browsers that don't support it #7099
If a browser that support webp makes a requests through ATS and the origin responds with Content-Type: image/webp that is cacheable ATS will cache the content. If a browser that doesn't support webp, like Safari, then makes a request ATS will serve back the image/webp response. This is because browser's send image/* and / in their Accept: header.
Request from Safari that doesn't support webp:
+++++++++ Incoming Request +++++++++
-- State Machine Id: 0
GET http:///eyJrZXkiOiJ1cGxvYWRzL21lZGl1bS9hc3NldC8xODE4L3Rlc2xhX3dpdGhfYV9yb3NlX29uX3RvcF9vZl9pdC5qcGciLCJidWNrZXQiOiJvc2xvLXByb2R1Y3Rpb24iLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjcwMCwiaGVpZ2h0IjpudWxsfX19 HTTP/1.1
Host: 192.168.1.10:8080
Connection: keep-alive
Accept: image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15
Accept-Language: en-us
Referer: http://192.168.1.10:81/safari.html
Accept-Encoding: gzip, deflate
@SolidWallOfCode can txnbox match on Safari in User-Agent and change image/* in Accept to a comma separated list like image/jpeg, image/gif, etc (with any q value used with image/*)? Would that fix this problem?
@ywkaras It won't work since the origin doesn't recognize q values and will send back image/webp again, since it has image/webp in the accept header.
It would however work if image/webp;q=0 is added before doing an ATS cache look up and then removed before going to the origin. I think we should just special case image/webp for now and remove it later in a few years. I have an internal PR up that has that type of logic.
Example of the origin sending back content-type: image/webp with Accept: image/webp;q=0 in the request:
Activity
ywkaras commentedon Aug 11, 2020
@SolidWallOfCode can txnbox match on Safari in User-Agent and change image/* in Accept to a comma separated list like image/jpeg, image/gif, etc (with any q value used with image/*)? Would that fix this problem?
bryancall commentedon Aug 11, 2020
@ywkaras It won't work since the origin doesn't recognize q values and will send back image/webp again, since it has image/webp in the accept header.
It would however work if image/webp;q=0 is added before doing an ATS cache look up and then removed before going to the origin. I think we should just special case image/webp for now and remove it later in a few years. I have an internal PR up that has that type of logic.
Example of the origin sending back
content-type: image/webpwithAccept: image/webp;q=0in the request: