Why does Twitter (twimg.com) use a suffix for size (e.g. ':large') instead of a query parameter
Asked Answered
C

2

7

Why does Twitter (twimg.com) use a suffix for size (e.g. ':large') instead of a query parameter?

Example:

https://pbs.twimg.com/media/CrhajQHXgAEQ2US.jpg:large

From an architectual standpoint I find this interesting and I'm wondering if I'm missing anything.
Do they do this because certain proxies/clients don't cache urls with query parameters?

Can anyone shed some light on this?

Conditional answered 4/9, 2016 at 18:31 Comment(0)
T
0

I am not sure this is due to some issue with caching, but there is a semantical point. URL https://pbs.twimg.com/media/CrhajQHXgAEQ2US.jpg:large points to a certain resource. And that resource is CrhajQHXgAEQ2US.jpg:large. It is not CrhajQHXgAEQ2US.jpg as it might be in a case with a query string.

Tericaterina answered 6/9, 2016 at 7:51 Comment(0)
D
1

According to https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#photo_format , using the suffix is a deprecated format, and they've moved (starting in 2015, but full internal use by 2017) to a query parameter version. The reason given is that:

Using the modern format will result in better CDN hit rate for the caller, thus improving load latencies by being less likely to have to generate and load the media from the Data Center.

(From that page, the 'modern', preferred URL would be https://pbs.twimg.com/media/CrhajQHXgAEQ2US?format=jpg&name=large .)

So my guess -- emphasis on my and guess -- is either that in the early days they decided to use the suffix format without complete thought on what would be easier for caching, or that you're right, but caching caught up with query parameters in the mid 2010s.

Dietz answered 16/10, 2021 at 0:19 Comment(0)
T
0

I am not sure this is due to some issue with caching, but there is a semantical point. URL https://pbs.twimg.com/media/CrhajQHXgAEQ2US.jpg:large points to a certain resource. And that resource is CrhajQHXgAEQ2US.jpg:large. It is not CrhajQHXgAEQ2US.jpg as it might be in a case with a query string.

Tericaterina answered 6/9, 2016 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.