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 Origin to Vary header on credentialed CORS response #1111

Merged
merged 4 commits into from Apr 6, 2021

Commits on Nov 26, 2020

  1. Add Origin to Vary header on credentialed CORS response

    According to the [MDN CORS docs]
    (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Access-Control-Allow-Origin), the `Origin`
    item should be added to the `Vary` header when the `Access-Control-Allow-Origin` is set to an
    explicit origin value, as opposed to the `*` wildcard.
    
    >If the server specifies a single origin (that may dynamically change based on the requesting origin
    as part of a white-list) rather than the "*" wildcard, then the server should also include Origin in
    the Vary response header — to indicate to clients that server responses will differ based on the
    value of the Origin request header.
    
    The existing code fails to update the `Vary` list when the server is configured to allow all
    origins (`*`) and the request has a `Cookie` header (ie. credentialed). In that situation, the
    `Access-Control-Allow-Origin` header will be set to the request's `Origin` value.
    
    It appears this may have just been a simple oversight in the original implementation. This updates
    the code to add `Origin` to the `Vary` header under these circumstancesIf it was intentionally
    omitted, I'd be delighted to learn why.
    Josh Wilson committed Nov 26, 2020
    Copy the full SHA
    b2d8b37 View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2020

  1. Add type annotations

    Josh Wilson committed Dec 11, 2020
    Copy the full SHA
    ba3fe37 View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2020

  1. Add test to ensure that the vary header does not contain origin if re…

    …quest is non-credentialed
    Josh Wilson committed Dec 17, 2020
    Copy the full SHA
    1673983 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2021

  1. Copy the full SHA
    f721ecb View commit details
    Browse the repository at this point in the history