Next.js Discord

Discord Forum

sec-fetch-mode: "cors" does not get sent in request, only on firefox

Unanswered
American Crocodile posted this in #help-forum
Open in Discord
American CrocodileOP
I attached an image below of how the same request looks like on Firefox and Chrome, with Chrome being the desired outcome. The Firefox way leads to CORS issues.

Code is:
export default function Thing(){
const fetchAPI(){
    const headers: HeadersInit = {
      "x-access-token": accessToken,
    };
    try {
      const response = await fetch(
        `${process.env.NEXT_PUBLIC_API_URL}/some/protected/route`,
        {
          headers: headers,
        }
      );
    } catch(err) //...
  }
}

1 Reply

American CrocodileOP
bump