Skip to main content

Practice ยท 3 of 3

CORS Decision Engine

Write corsDecision(origin, allowedOrigins, credentials) โ€” origin is the request's Origin header; allowedOrigins is an array (may contain "*"); credentials is boolean. Rules: origin not in list (and no "*") => "deny"; "*" with credentials => "deny" (forbidden combo); origin in list (or "*") without credentials => "allow"; origin in list with credentials => "allow-with-credentials".

Difficulty: intermediate

Back to lesson: Practice: Headers & CORS โ€” Practice