Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q. NGINX에서 CORS(Cross-Origin Resource Sharing)처리할 경우 설정 방법은? #3

Open
utterances-bot opened this issue Apr 17, 2023 · 2 comments

Comments

@utterances-bot
Copy link

Q. NGINX에서 CORS(Cross-Origin Resource Sharing)처리할 경우 설정 방법은?

A. 요청 메소드 OPTIONS에 대한 설정을 추가하면 된다. CORS 관련 확인을 위해서 사전요청preflight이 발생한다. 이 사전요청은 OPTIONS 요청 메소드로 이루어진다. 그래서 NGINX에서 OPTIONS 요청 메소드 처리를 추가하면 된다. server { ... location / { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' $http_origin; add_header 'Access-Control-Allow-Methods' 'GET, POST, PATCH, DELETE, OPTIONS'; add_header 'Access-Control-A

https://taptorestart.tistory.com/entry/Q-NGINX%EC%97%90%EC%84%9C-CORSCross-Origin-Resource-Sharing%EC%B2%98%EB%A6%AC%ED%95%A0-%EA%B2%BD%EC%9A%B0-%EC%84%A4%EC%A0%95-%EB%B0%A9%EB%B2%95%EC%9D%80

Copy link

깔끔하게 정리해주셨네요! 잘 읽었습니다!

@taptorestart
Copy link
Owner

깔끔하게 정리해주셨네요! 잘 읽었습니다!

@wild-mental 정리한 내용이 잘 전달된 거 같아 기쁘네요. 댓글 감사합니다:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants