Skip to content

If a resource allows credentials but omits Vary, shouldn't responses to non-CORS requests also contain Access-Control-Allow-Credentials? #1601

Open
@jub0bs

Description

@jub0bs

While completing the test suite of my CORS middleware library, I ran into an interesting case. The section entitled CORS protocol and HTTP caches says the following:

[...] if Access-Control-Allow-Origin is set to * or a static origin for a particular resource, then configure the server to always send Access-Control-Allow-Origin in responses for the resource — for non-CORS requests as well as CORS requests — and do not use Vary.

However, in the case of a resource that

  • systematically includes Access-Control-Allow-Origin: https://example.com in all responses,
  • omits the Vary header (as explained above), but
  • happens to allow credentials,

shouldn't responses to non-CORS requests also contain Access-Control-Allow-Credentials: true? Otherwise,

  • a response to a non-CORS request lacking that header could get cached, and
  • that cached response could subsequently get served for credentialed CORS requests from https://example.com.

This situation would unduly cause the CORS check to fail (at step 8). Unless I'm missing something, perhaps this consideration deserves a mention in the standard.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions