how to enable CORS on an Azure Virtual Machine ?

Jespère KIKI 0 Reputation points
2023-09-16T10:02:20.9333333+00:00

I am running an fastapi at localhost:8025 and nextjs app at localhost:3550., it work perfectly in local environment . However, in the virtual machine instance on azure it doesn't work and i'm getting CORS error. Inside my fastapi i have yet allowed all origins so i'm confused. Can someone help me solve this ?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,806 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,407 questions
{count} votes

1 answer

Sort by: Most helpful
  1. TP 90,556 Reputation points
    2023-09-16T11:53:45.45+00:00

    Hi,

    Please verify that correct headers are being sent by the server and client. You can do this via browser Developer Tools -- Network tab, or using Fiddler or similar web debugging tool. In this way you can see what is actually being sent between client PC and server and narrow down source of the issue.

    Please click Accept Answer if the above was useful. If something is unclear or you further assistance please add a comment below.

    Thanks.

    -TP

    0 comments No comments

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.