“Problema de Cors angular” Código de respuesta

Cómo arreglar Cors en angular

in PHP server:
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT');
    header('Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding, X-Auth-Token, content-type');

in Angular POST request:
	const httpOptions = {
 	 	headers: new HttpHeaders()
	}

    httpOptions.headers.append('Access-Control-Allow-Origin', '*');
    httpOptions.headers.append('Content-Type', 'application/json');
    httpOptions.headers.append('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');

	this.httpClient.post(<url>, <body>, httpOptions);
Nickton

Problema de Cors angular

header('Access-Control-Allow-Origin: *');
Ashamed Ant

Agregar Cors en angular

"architect": {
    "serve": {
            "builder": "@angular-devkit/build-angular:dev-server",
            "options": {
                "browserTarget": "project-name:build",
                "proxyConfig": "src/proxy.conf.json"
            },
          }
}
Quaint Quail

Respuestas similares a “Problema de Cors angular”

Preguntas similares a “Problema de Cors angular”

Más respuestas relacionadas con “Problema de Cors angular” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código