Cross-domain settings do not take effect #8619
-
First Check
Commit to Help
Example Codedef register_cors_middleware(app: FastAPI) -> None:
logger.info("register cors middleware")
app.add_middleware(
CORSMiddleware,
allow_origins=[],
# allow_origins=["http://127.0.0.1:7878"],
allow_credentials=True,
allow_methods=['POST'],
allow_headers=['*'],
)DescriptionWhen I configure the allow_origins parameter to be empty, or specify the ip, the server side is not intercepted, and the request can still be made. Operating SystemLinux Operating System DetailsNo response FastAPI Versionfastapi=0.75.0 Python VersionPython 3.9.10 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
YuriiMotov
Jun 19, 2025
Replies: 1 comment
-
|
Everything works as expected in current version (0.115.13). The problem was probably in how the request was sent |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Everything works as expected in current version (0.115.13).
The problem was probably in how the request was sent