Skip to content

CORS Access-Control-Allow-Headers Problem #4776

@badrelmazaz

Description

@badrelmazaz

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

origins = [
    "*"
]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

Description

I set allow_headers=["*"]
but when browser tries to post:
Immagine 2022-04-10 000120
And the response of the options request to get the cors info there are 2 Access-Control-Allow-Headers, I think it is quite weird
InkedImmagine 2022-04-10 000227_LI

Operating System

Linux

Operating System Details

No response

FastAPI Version

0.75.1

Python Version

3.9

Additional Context

No response

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