ACAO Origin reflection and Set-Cookie header in response #1606
Unanswered
jabberabbe
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone and thanks for the effort you put into Starlette! It's a very well-designed piece of software.
I think I spotted an issue in
CORSMiddleware
. AFAICT, using thefetch
API, credentials (including cookies) are saved only ifcredentials: 'include'
is passed as afetch()
option. [Source: MDN]If
credentials: 'include'
is passed to fetch, thenAccess-Control-Allow-Origin: *
is not allowed as a valid response header. This is correctly handled inCORSMiddleware
by reflecting the requestOrigin
into theACAO
header if cookies were present in the request.However, a credentialed request may not include cookies in the request but may require appropriate origin reflection if a response includes
Set-Cookie
headers.CORSMiddleware
is not aware of this (code here).ACAO: *
withSet-Cookie: ....
triggers errors.This can be temporarily fixed by using a wildcard
allow_origin_regex
.Should I open an issue?
Beta Was this translation helpful? Give feedback.
All reactions