Skip to content
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

Allow short URL redirects to be cached by proxy-cache/CDN services #2093

Open
acelaya opened this issue Apr 9, 2024 · 0 comments
Open

Allow short URL redirects to be cached by proxy-cache/CDN services #2093

acelaya opened this issue Apr 9, 2024 · 0 comments

Comments

@acelaya
Copy link
Member

acelaya commented Apr 9, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant