Getting the Yeelight binding to work with a reverse proxy in Docker

Hi,

I’m trying to get the Yeelight binding to work with Openhab and a Nginx reverse proxy in separate Docker containers. Is this possible as the Yeelight bulbs and the Docker containers reside in different subnets?

I’m not using the ‘network_mode: host’ as that will overrule (not sure about this) the reverse proxy. The reason for using the reverse proxy is because I’m using wborn’s embedded Grafana panel implementation (I removed the Grafana part from the compose and Nginx file for convenience)

The Yeelight things go offline after initializing and stay offline as shown in the event log:

2019-09-02 19:34:54.681 [.ItemChannelLinkAddedEvent] - Link 'light_bulb_10_sw-yeelight:wonder:light_bulb_10:color' has been added.
2019-09-02 19:43:01.609 [hingStatusInfoChangedEvent] - 'yeelight:wonder:light_bulb_10' changed from UNINITIALIZED to INITIALIZING
2019-09-02 19:43:01.637 [hingStatusInfoChangedEvent] - 'yeelight:wonder:light_bulb_10' changed from INITIALIZING to OFFLINE: Device is offline!

The documentation describes that UPnP is needed for discovery, so I exposed port 1900 in the Docker compose file.
NMAP shows that port 1900 is up:

Host is up.
PORT     STATE    SERVICE
1900/tcp filtered upnp

Docker-compose file:

version: '2'
services:
  reverseproxy:
    image: reverseproxy
    ports:
    - 5001:5001
    restart: always
  openhab:
    depends_on:
    - reverseproxy
    image: "openhab/openhab:2.4.0"
    restart: always
    ports:
    - "8080:8080"
    - "8443:8443"
    - "1900:1900" #UPNP
    volumes:
    - "/etc/localtime:/etc/localtime:ro"
    - "/etc/timezone:/etc/timezone:ro"
    - "/opt/openhab/addons:/openhab/addons"
    - "/opt/openhab/conf:/openhab/conf"
    - "/opt/openhab/userdata:/openhab/userdata"
    environment:
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
      USER_ID: "999"
      GROUP_ID: "999"

Nginx configuration:

worker_processes 1;
events { worker_connections 1024; }
http {
    sendfile on;
    upstream docker-openhab {
        server openhab:8080;
    }
    server {
        listen 5001;
        server_name	localhost;
        location / {
            proxy_pass           http://docker-openhab;
            proxy_buffering	     off;
            proxy_set_header     Host $http_host;
            proxy_set_header     X-Real-IP $remote_addr;
            proxy_set_header     X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header     X-Forwarded-Proto $scheme;
        }
    }
}