node.js Express CORS Pre-flight

Failed to load http://127.0.0.1:3000/test: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://127.0.0.1:3001’ is therefore not allowed access.

AJAX가 웹사이트에 GET등을 요청할 때 미리 OPTIONS 메서드를 사용해 웹사이트에서 사용가능한지 묻기 때문에 GET뿐만 아닌, OPTIONS도 허용해야함

Leave a Reply

Your email address will not be published. Required fields are marked *