Allow short URL redirects to be cached by proxy-cache/CDN services #2093
Open
Description
All short URLs in Shlink are either 301/308 redirects which should not/are not cached, or 302/307 redirects with Cache-Control: private,...
, which are intended to not be cached by intermediary proxy servers, but end-user browsers only.
This presents a problem when Shlink is served behind a CDN-like service, where users will be accessing to the edge server which is closer to them, but still need to end up going to Shlink's upstream service.
With a different HTTP caching, the CDN would be able to cache the redirect, and users would get redirected much faster.
This of course has several considerations, which means it should be an opt-in behavior:
- Once an edge server has cached the redirect, all users hitting that server will be redirected without a visit being tracked by Shlink. This could be mitigated by setting short cache periods, but finding the right balance might be tricky.
Some users might not care about visits, but I can foresee many people confused by this. - The existing redirect status feature, incidentally allows setting
Cache-Control
headers, which could be reused for this purpose. It would require allowing to customize if the caching is public or private.
It might not be super intuitive to mix these two though, so it needs a bit of extra thinking.
Metadata
Assignees
Type
Projects
Status
No status