I have query about CORS policy

  angular, asp.net-core, azure, cors, heroku

My website has front-end hosted in heroku server and back-end hosted in azure server.My project is mainly a .Net Core with Angular framework.Whenever i want to get some information from backend there’s an error showing

Access to XMLHttpRequest at "backend domain" from origin "frontend domain" has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I have cors policy in backend where i built,

 services.AddCors(options =>
        {
            options.AddPolicy(
               name: "AllowOrigin",
               builder => {
                   builder.WithOrigins("frontend domain")
                       .AllowAnyHeader()
                       .AllowAnyMethod();
               });
        });

but it still shows me the same error. I intentionally replaced my domain name for some credential issues.

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.