PREFLIGHT
Preflight는 실제 요청 전에 허용 범위를 묻는다
브라우저는 OPTIONS 요청으로 method와 header 허용 여부를 확인한 뒤, 성공하면 실제 CORS 요청을 보낸다.
OPTIONSallow headersactual request
01OPTIONS
Origin, Access-Control-Request-Method,
필요 시 request headers를 보낸다.
02204 or 200서버는 허용 origin, methods, headers를 응답한다.
03preflight cache
Access-Control-Max-Age로 결과 캐싱을 요청할 수
있다.
04actual request허용되면 실제 GET/POST/PUT 요청이 전송되고 응답 노출을 다시
판단한다.
OPTIONS /orders Origin: https://app.example Access-Control-Request-Method: POST Access-Control-Request-Headers: content-type, authorization