I have a REST API running from a container but the port is published so I can access the web service from any machine using . Everything is good.
Now, I have another application running on a different container on the same host, which should consumes the web service (running in the other container). For some reason, the web service always returns 400 Bad Request when trying to consume from the app in the container...
If trying the app from the same host or outside, it always works! I'm not sure if I 'm missing some configuration, but calling the API from inside a container, shouldn't be the same if using the URL?
I would appreciate any help.
Gus
I have a REST API running from a container but the port is published so I can access the web service from any machine using https://myapi/myservice. Everything is good.
Now, I have another application running on a different container on the same host, which should consumes the web service (running in the other container). For some reason, the web service always returns 400 Bad Request when trying to consume from the app in the container...
If trying the app from the same host or outside, it always works! I'm not sure if I 'm missing some configuration, but calling the API from inside a container, shouldn't be the same if using the https://myapi/myservice
URL?
I would appreciate any help.
Gus
- 400 Bad Request which means that it is hitting a server and it is responding to your request. Could you just be sending an invalid request? – Jason Gallagher Commented Nov 21, 2024 at 2:46
- Please share a minimal reproducible example – OneCricketeer Commented Nov 21, 2024 at 2:54
1 Answer
Reset to default 0For first step,maybe you should check DNS resolution name inside of the container that you're tying to call.
or trying to do the telnet first whether the expected port can be called inside container. Just for crosscheck.
Or better use container port directly to call the other container For example, if the API container is named api-service, you can access it using http://api-service:port/myservice
instead of using public domain