Issues.Communicating between Two Instance under Docker

Description

Briefly about my RocketChat setup. It situated behind Proxy. Also it works under docker. Issues begin at this place. In order to send message to mobile client I have to use HTTP(s)_PROXY settings and it works fine. Anothe task is launch two Rocket.Chat instances. If HTTP_PROXY settings are “on”, they cannot communicate each other because all requests forward to proxy. In other hand, if HTTP_PROXY to turn off then Instances speak each other, but Rocket.Chat cannot send any messages to mobile clients.
Need help! May be somebody know how to configure chat that both features work simultaniously?

Server Setup Information

  • Version of Rocket.Chat Server: 3.0.1
  • Deployment Method: docker
  • Number of Running Instances: 2
  • DB Replicaset Oplog: enable
  • NodeJS Version: 12.14.0
  • MongoDB Version: 4.0.12
  • NPM: 6.13.4

Any additional Information

Here my docker-compose.yml

version: '2'

services:
  rocketchat:
    image: rocketchat/rocket.chat:3.0.1
    command: >
      bash -c
        "for i in `seq 1 30`; do
          node main.js &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 secs...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
      - ./uploads:/app/uploads
    environment:
      - PORT=3000
      - ROOT_URL=http://chat.example.loc:3000
      - MONGO_URL=mongodb://mongo:27017/rocketchat
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local
      - HTTP_PROXY=http://proxy.example.loc:3128
      - HTTPS_PROXY=http://proxy.example.loc:3128
      - INSTANCE_IP=rocketchat
    depends_on:
      - mongo
    ports:
      - 3000:3000
    networks:
      - chat_net

  rocketchat2:
    image: rocketchat/rocket.chat:3.0.1
    command: >
      bash -c
        "for i in `seq 1 30`; do
          node main.js &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 secs...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
      - ./uploads2:/app/uploads
    environment:
      - PORT=3000
      - ROOT_URL=http://chat.example.loc:3000
      - MONGO_URL=mongodb://mongo:27017/rocketchat
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local
      - HTTP_PROXY=http://proxy.example.loc:3128
      - HTTPS_PROXY=http://proxy.example.loc:3128
      - INSTANCE_IP=rocketchat2
    depends_on:
      - mongo
    ports:
      - 3001:3000
    networks:
      - chat_net
  
  mongo:
    image: mongo:4.0
    restart: unless-stopped
    volumes:
     - ./data/db:/data/db
     - ./data/dump:/dump
    command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
    networks:
      - chat_net

networks:
  chat_net: