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

Adding max-age to redirects #33

Open
chrean opened this issue May 8, 2018 · 4 comments
Open

Adding max-age to redirects #33

chrean opened this issue May 8, 2018 · 4 comments

Comments

@chrean
Copy link

chrean commented May 8, 2018

301s are cached by browsers (at least Firefox and Chrome) with no expiry date.
This poses a problem when we need to update redirects in some cases.

I suggest adding a header like Cache-Control: max-age= where seconds may be a fairly large number, perhaps even one day.

We may think of setting up a default behaviour and some configurable params.

@GaryJones
Copy link
Contributor

Should this only be for 301, and not 302?

On my local test system, I'm seeing:

Cache-Control: no-cache, must-revalidate, max-age=0

On a VIP test site, I'm seeing:

cache-control: max-age=300, must-revalidate

@GaryJones
Copy link
Contributor

Thought - if the redirect has only been added in the last 24 hours, make it max-age=60 or something really small.

If the redirect was added longer ago than 24 hours, make it a max-age={a day}.

These two values would be filterable.

The idea being that someone may add an incorrect redirect, and end up having to wait a day or force clear their cache before being able to confirm it has been fixed.

@bdtech
Copy link
Contributor

bdtech commented May 24, 2019

You'll also have to be sure to avoid creating additional cache-control: headers as one could be set already.

These redirects also are cached by their max-age, respecting the TTL, upstream via proxies such as Nginx, Varnish, CDN's, etc.

@GaryJones GaryJones added this to the Future Release milestone Jun 7, 2019
@GaryJones
Copy link
Contributor

For VIP, the docs say:

Redirects with a 302 HTTP Status are cached for 1 minute, redirects with a 301 HTTP Status are cached for 30 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants