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 - 192.168.30.5) they have ip addresses 172.25.0.4, 172.25.0.5, 172.25.0.6, 172.25.0.7. I have the same set of containers deployed on another docker server (Server B 192.168.30.6). I have a frontend application on one of the containers 172.25.0.7. On both servers (A and B) i have an nginx proxying the docker container for the frontend on port 12345 (192.168.30.5:12345, 192.168.30.6:12345). When i reach the frontend on 192.168.30.5:12345 it makes a requests to the backend on 172.25.0.5.
The problem is that when i reach the container for the frontend on server A 192.168.30.5:12345 it gets the data from 172.25.0.5 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 127.25.0.0/24 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.