Can't figure out how to use Internal Address

I have a Sping app running on render.com inside docker with port 8080 exposed (EXPOSE 8080 inside Dockerfile), it can be accessed successfully via external url and custom domain I assigned to it.

And I have a Next.js app with SSR and I wound like to access Spring app from it via internal address.

How do I do that? Both services are in the same region.

I can wget my frontend app from backend one using wget service-frontend:10000 and receive 500 error code, since frontend can’t connect to the backend.

But I can’t access backend from frontend.

I tried using both http://service-backend:8080 and service-backend:8080, I tried port 80 and no port at all.

All I get is:

render@srv-long-id:~/project/src$ wget service-backend:8080 
--2021-07-06 19:05:58--  http://service-backend:8080/
Resolving service-backend (service-backend)... 10.xxx.xxx.76
Connecting to webcam-backend (service-backend)|10.xxx.xxx.76|:8080... failed: Connection refused.

Thanks in advance!

Using IP-address I got from ip a seems to be working

It seems that issue is that it tries to connect to the different IP-address:

I tries to connect to 10.XXX.XXX.76, but from ip a I got 10.YYY.YYY.161 and it’s working!

render@srv-long-id:~/project/src$ wget service-backend:8080
--2021-07-06 19:17:56--  http://service-backend:8080/
Resolving service-backend (service-backend)... 10.XXX.XXX.76
Connecting to service-backend (service-backend)|10.XXX.XXX.76|:8080... failed: Connection refused.
render@srv-c3ia1kc6fj3fflsg9220-64b76c5cf7-f2ggb:~/project/src$ wget 10.YYY.YYY.161:8080
--2021-07-06 19:18:17--  http:// 10.YYY.YYY.161:8080/
Connecting to  10.YYY.YYY.161:8080... connected.
HTTP request sent, awaiting response... 200 
Length: unspecified [application/hal+json]
Saving to: ‘index.html’

index.html                              [ <=>                                                              ]     216  --.-KB/s    in 0s      

2021-07-06 19:18:17 (14.9 MB/s) - ‘index.html’ saved [216]

render@srv-long-id:~/project/src$ 

Hey @yatxone,

It looks like we failed to detect port 8080 when creating your internal connection string and used the default of 10000. I’ve updated it and you should now be able to connect with service-backend:8080. Can you let me know if it works for you?

1 Like

It works! Thanks!
Is it possible that it might break on the next deploy?

Great to hear! A new deploy should not revert this change.

1 Like