#Serving site to production environment, Axios `ERR_CONNECTION_REFUSED` errors!

15 messages ยท Page 1 of 1 (latest)

flat scarab
#

And this is the code I am using to fetch these images:

#

Am I not supposed to use localhost, but instead the IP of the machine? As this is extremely problematic for switching between dev and localhost if I don't understand this correctly ๐Ÿ’€

thorn crown
#

do you have a separate Backend or you use /pages/api in NextJS?

thorn crown
flat scarab
thorn crown
#

ok, sure, sorry

#

so on the localhost, it works and on production not ?

#

maybe it is a PORT problem

flat scarab
#

Ah I fixed it by making a function to get those URLs I'm using in requests like this:

#

So now it works - idfk why I was trying to use localhost or 127.0.0.1 in a production app - must be fucking friday end of week tiredness ๐Ÿคฃ

#

Thanks anyway @thorn crown ๐Ÿ‘

thorn crown
#

your welcome ๐Ÿ˜‰

#

i wish you a good weekend ๐Ÿ˜‰

warped sinew
#

you should use env vars to read the URLs conveniently