Latihan 1: CORS Deep Dive — Security

Latihan 1 dari materi CORS Deep Dive di Security — praktek dengan editor kode interaktif, test case otomatis, dan hint terpandu. Langsung jalan di browser.

Buat fungsi setCORSHeaders(res, origin, allowedOrigins) yang mengatur CORS headers pada response object.

Gunakan res.setHeader(name, value) untuk mengatur header.

Output yang diharapkan:

Allowed: https://myapp.com
Blocked: undefined

Hint