Azure webapp as backend with azure static webapp as frontend throws code:400 error

Bhanu Chander V 0 Reputation points
2024-02-01T05:18:42.4866667+00:00

I've created azure webapp as backend and static webapp as frontend and when I tried to run backend I see the following message User's image

I haven't added any authentication or AD to the apps. What could be the issue? In my backend app.py I've added CORS something like :

cors_origin = {
    #"origin": get_origin,
    "origin": "https://my_static_app.azurestaticapps.net/api",  # or whatever port your frontend is using
    "credentials": True,
    "methods": ["POST", "GET", "PATCH", "HEAD", "PUT",  "DELETE",  "OPTIONS"],
    "allow_headers": ['Content-type','Authorization','Origin','Access-Control-Allow-Origin','Accept','Options','X-Requested-With'],
    "options_success_status": 200,
}
 
CORS(app, **cors_origin)

what could be the issue?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.