이 프로젝트는 인증을 위해 angular2 j의 angular2-authentication-sample을 따르고 있습니다. Signup Endpoint에 요청할 때이 문제가 발생합니다. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/auth/register. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
교차 원점 요청이 차단됨 : 동일한 원점 정책이 http : // xxx : xx/register에서 원격 리소스를 읽지 못하도록합니다.
나는 다른 질문을 확인하고 headers에 여분의 머리글을 추가했습니다.
headers.ts
import { Headers } from '@angular/http';
export const contentHeaders = new Headers();
contentHeaders.append('Accept', 'application/json');
contentHeaders.append('Content-Type', 'application/json');
contentHeaders.append('Access-Control-Allow-Origin', '*');
contentHeaders.append('Access-Control-Request-Method', '*');
contentHeaders.append('Access-Control-Allow-Methods', '');
contentHeaders.append('Access-Control-Request-Headers', 'Origin, Content-Type, Accept');
나는이 CROS 문제를 풀기가 할 수 아니에요.