Questions tagged cors

Explore the latest questions and answers asked by our top developers.

post method throws error,GET method working fine in API call in Angular

I getting below error in post method, GET method working fine also tried proxy configuration Access to XMLHttpRequest at ‘https://demotest/loginapi’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. proxy.config.json { "/loginapi": { "target": ‘https://demotest’ "secure": false, "changeOrigin": true, "logLevel": "info" } } […]

By Mani N
Categorized as angular, cors Tagged ,

Cross-Origin Request Blocked error when Https redirection is enabled with Spring Boot and Angular

I am using Spring Boot for REST API and Angular for front end. Recently I enabled Https redirection to redirect users to HTTPS when they typed HTTP in URL. In deployment I just put Angular build output in Spring Boot’s static folder hence there is no issues but while debugging with Angular code in WebStorm […]

By Ram
Categorized as angular, cors, https, spring-boot Tagged , , ,

Cross-Origin Request Blocked js files (angular deployed on nginx )

hello i am facing issue i’m using nginx server on centOS linux after i deployed my angular project and configuration when i run on browser it gave error on internal generated js files and browser page is still blank this is my config file: listen 80; server_name localhost; location / { root /usr/share/nginx/html/core-app-plus; index index.html […]

By Abdul Mateen
Categorized as angular, cors, cross-domain, nginx Tagged , , ,

How do I resolve the CORS – No Allow Credentials error?

I have an Angular front end making requests to an nginx back end. Right now the nginx server is just returning a static response, but eventually it will proxy to a back end. However I can’t seem to get past a CORS error – Firefox reports "CORS No Allow Credentials" in the network tab. The […]

By DrTeeth
Categorized as angular, cors, nginx Tagged , ,

Cross-origin request blocked .net 5 + Angular application

I’m facing errors with CORS. I’m using .NET 5 (Api) and Angular 13. My API is set to allow any origins/headers/methods like this: Startup.cs: public void ConfigureServices(IServiceCollection services) { services.AddCors(ConfigureCorsPolicy); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseCors("MyPolicy"); } private void ConfigureCorsPolicy(CorsOptions opt) => opt.AddPolicy("MyPolicy", builder => builder.WithOrigins(Configuration["Cors:AllowOrigins"]) .WithMethods(Configuration["Cors:AllowMethods"]) .WithHeaders(Configuration["Cors:AllowHeaders"]) ); appsettings.json : "Cors": […]

By manus
Categorized as .net, .net-5, angular, c#, cors Tagged , , , ,

preflight request doesn’t pass access control check:

I am getting below error when trigger http call in angular Access to XMLHttpRequest at ‘loginapi’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. userdata(user: string): Observable<any> { const form = new FormData(); return this.http.put<any>(`/${user}`, form, […]

By Mani N
Categorized as angular, angular10, cors, http Tagged , , ,

Why NodeJS server sends blocked by CORS policy: No ‘Access-Control-Allow-Origin when many people use API

I have a question about CORS in NodeJS. This is my API code working on sub domain and it communicates with my web app created in Angular on domain import express from ‘express’; import bodyParser from ‘body-parser’; import * as dotenv from ‘dotenv’; import morgan from ‘morgan’; import swaggerUI from ‘swagger-ui-express’; import * […]

By Rafael
Categorized as angular, api, cors, node.js Tagged , , ,

Access to XMLHttpRequest at ” from origin ‘http://localhost:4200’ has been blocked by CORS. I don’t have the access to server

I am tryingto consume a public API, but I have a failure answer. I tested with Postman and with browsers (like google chrome and microsoft edge), and I can consume the API, but when I tried to consume the API with my angular app, I don’t have a successfully answer 😔 The answer is: "Access […]

By Fabian Rico
Categorized as angular, api, cors Tagged , ,

Angular CORS OAuth2 wont let me in

I want to authenticate on an external server to get some data. When I try to authenticate, I get a Cors error. I also have a proxy.conf.json but it doesn’t seem to work Code: authUrl = "http://localhost:4200/auth" tokenUrl = "http://localhost:4200/tokenUrl" redirect_uri = "http://localhost:4200" auth(clientId: string, secredId: string) { const url = this.authUrl + ‘?client_id=’ + […]

By yoyo
Categorized as angular, cors, oauth-2.0 Tagged , ,

symfony 5 and angular app CORS issue on preflight requests

I have opened wide the CORS config in my symfony 5 app with nelmio cors bundle, but i dont understand why my POST and OPTIONS preflight calls from Angular / Axios gets rejected by the CORS config. When everything of the front is bundled and deployed on the same domain it works fine, but on […]

By Ty Kayn
Categorized as angular, axios, cors, symfony, xmlhttprequest Tagged , , , ,
1 37

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us