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

Add cache-control & pragma headers to redirect responses #19

Merged
merged 3 commits into from
Jan 7, 2022

Conversation

ineale2
Copy link
Contributor

@ineale2 ineale2 commented Oct 20, 2021

Issue # (if available): #18

Description of changes:
Add cache-control and pragma headers to 302 responses. This is my first time opening a PR for an OS project. I'd suggest updating the package version to 1.2 as well. Apologies, as I'm not sure if that's something I should do in the PR submission or if that is done at the time of merge. Let me know if any update is required.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jeandek jeandek added the bug Something isn't working label Oct 22, 2021
Copy link
Contributor

@jeandek jeandek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR Isaac! We'll take care of the version increment when we release a new version. It may/will contain multiple PRs, so they should not change the version.

Your PR looks good to me overall, except one detail (see below).

index.js Outdated
}],
'cache-control': [{
key: 'Cache-Control',
value: 'no-cache, no-store, max-age=0, must-revalidate'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MDN documentation page for Cache-Control discourages putting that many directives in the header. It seems that no-store, max-age=0 would achieve the same results.

Is there a reason (such as a browser-specific edge case) you are providing redundant directives?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Reading through that I do agree that we can reduce this here to no-store, max-age=0. For context, I copied the headers here from other auth providers (Midway & Federate), which do provide the redundant headers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After investigating, browser support for the cache-control directives appears to be inconsistent so let's keep those redundant headers. My apologies for the delay in merging this and thanks for your contribution.

@jeandek jeandek added this to the 1.1.1 milestone Oct 22, 2021
@jeandek jeandek merged commit 6b6711c into awslabs:main Jan 7, 2022
@jeandek jeandek linked an issue Jan 7, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Cache-Control headers to redirect responses
2 participants