Home assistant gives often time out with external URL

I don know where to search anymore. Hopfully someone can give me the tip to discover whatś going on.

THis is my situation: I run Home assistant in docker on a NUC (I5) for year now and it worked really great. However. Since a month or twoo, I get timeouts when I access it from outside.

II have my own domain and forward it to my local server. It runs Traefik as a reverse procy, offloading SSL. I use it for both home assistant and Nextcloud and that is still stable available from outside where Home Assistant fails often. Sometimes it suddenly works. Also Uptime robot keeps informing me several times a day Home Assistant to be down or up again.

The NUC has a I5 and 4G of memory, running docker on Ubuntu server LTS.
Whe I run Developer tools network monitoring in a browser, it seems that often something goes wrong with a token?

Here is my stack setup using Home Assistant, ZwaveJS and MariaDB

# Home assistant, ZwaveJS and MariaDB

version: '2'
networks:
  lan:
    external: true

services:
  zwavejs:
    image: zwavejs/zwavejs2mqtt:latest
    container_name: zwavejs
    restart: unless-stopped
    devices:
      - "/dev/ttyACM0"    
    environment:
      - PGID=1000
      - PUID=998
      - TZ=Europe/Amsterdam
    volumes:
      - /opt/ha/zwave:/usr/src/app/store
    networks:
      - lan
    ports:
      - 3000:3000
      - 8091:8091
 
  home-asstant:
    image: homeassistant/home-assistant:latest
    container_name: homeAssistant
    restart: unless-stopped
    network_mode: "host"
    environment:
      - PGID=1000
      - PUID=998
      - TZ=Europe/Amsterdam
    depends_on:
      - mariadb
      - zwavejs
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /opt/ha/hass:/config

  mariadb:
    image: mariadb:10.1
    container_name: mariadb
    restart: unless-stopped
    environment:
      - PGID=1000
      - PUID=998
      - TZ=Europe/Amsterdam
    networks:
      - lan
    ports:
      - 3306:3306
    volumes:
      - /opt/ha/db:/var/lib/mysql

Is it to say you have no issue when accessing HA from the inside?
Any relevant logs in HA or Traefik ?

Yes when I try to connect from inside with the ip address it just works fine…

Update: I discovered that many devices in my zwaveJS integration had invalid or unknown Entities. re-interviewing the zwave devices and removing the invalid entities makesv HA some more responsive, but does not resolve this issue.

Next to that I discovered issues with websocket calls in combination with my Traefik ssl offloading proxy. I fixed that by adding a middleware rule in Traefik:

traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https,wss

This solved the issue