I'm trying to fetch from an external api but I get (forbidden).
Locally it works ok.
I added the vercel.json file with headers, in the admin I enabled OPTIONS Allowlist and entered the path /api.
What could be missing?
Using astro framework
const res = await fetch('EXTERNAL_API', { headers: {
"Content-Type": "application/json", "Access-Control-Allow-Credentials": "true" , "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET,OPTIONS,PATCH,DELETE,POST,PUT" , "Access-Control-Allow-Headers": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }, });
const result= await res.json();added vercel.json
OPTIONS Allowlist -> /api