Problem with docker container redirecting to docker container on different host

Hi there,
I have a few docker containers deployed on a docker server (Server A - they have ip addresses,,, I have the same set of containers deployed on another docker server (Server B I have a frontend application on one of the containers On both servers (A and B) i have an nginx proxying the docker container for the frontend on port 12345 (, When i reach the frontend on it makes a requests to the backend on
The problem is that when i reach the container for the frontend on server A it gets the data from on server B. Why is that, how to fix it ?
I am attaching a sample diagram

Have a nice day !

Are you using Docker Swarm?

Is is a docker bridge network? It should neither be a subnet any host interface is attached to, nor a subnet that can be reached via routing. Something is not adding up here.

Please share the compose files you use to set up the network and the service deployments.