Next.js Discord

Discord Forum

ENOTFOUND on server side

Unanswered
French Angora posted this in #help-forum
Open in Discord
French AngoraOP
My current set up is:
- backend server on localhost:8080
- nextjs server on localhost:3000
- nginx reverse proxy mapping dev.localhost -> localhost:3000 and api.dev.localhost -> localhost:8080 to avoid browser CORS issues

when I try to do a server-side fetch, it fails when I am using http://api.dev.localhost/, but it works fine when I am using http://localhost:8080. I am not sure why this is happening.

const response = await fetch("http://localhost:8080/graphql"); //works
const response = await fetch("http://api.dev.localhost/graphql"); //fails

0 Replies