Nginx, Next.js and API in docker containers
Unanswered
Chinese softshell turtle posted this in #help-forum
Chinese softshell turtleOP
Hello, its my first time dealing with such "issue".
I had error when making a request in development to my API from the server side of next.js (connection refused)
On the browser i am making requests such as
But on the next.js's server enviroment for example
Is this how it should be?
Do i need 1 env variable for the browser and 1 env variable for the server side of next.js?
Am i understanding correctly, that on the browser i must use the domain
Thank you!
I had error when making a request in development to my API from the server side of next.js (connection refused)
On the browser i am making requests such as
http://localhost/api/... those directly point to my API serverBut on the next.js's server enviroment for example
page.tsx doing so fails. I had to make request to my API via http://{nginx_service_name}/api...Is this how it should be?
Do i need 1 env variable for the browser and 1 env variable for the server side of next.js?
Am i understanding correctly, that on the browser i must use the domain
example.com/api ,and on the server i should use the nginx service name?Thank you!