Accessing node-red on port 1880 through public url with nginx or caddy

Hello, I’m trying to use the public device url to access other services on my device using caddy, but it just won’t load the /nodered page and there are no errors. If anyone could give any suggestions that would be great…

my files:

part of my docker-compose:

node-red:
    build: ./node-red
    ports:
      - '1880:1880'
    devices:
      - '/dev/mem:/dev/mem'
      - '/dev/gpiomem:/dev/gpiomem'
      - '/dev/i2c-1:/dev/i2c-1'
    restart: always
    volumes:
      - 'ftpdata:/data'
    privileged: true
    network_mode: host
    labels:
      io.balena.features.supervisor-api: '1'

 
   caddy:
    build: ./caddy
    restart: unless-stopped
    network_mode: host
    privileged: true
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - caddy_data:/data
      - caddy_config:/config
  

dockerfile:

  FROM caddy:2.6.4

# Copy Caddyfile to /etc/caddy/Caddyfile
COPY Caddyfile /etc/caddy/Caddyfile

# Format the Caddyfile
RUN caddy fmt --overwrite /etc/caddy/Caddyfile


Caddyfile:

:80 {
    redir https://{host}{uri}
}

:443 {
    tls internal
    reverse_proxy /nodered/* http://localhost:1880
}

1 Like

Hello @cheezymcsquibble

What error do you get here? Could you please share more?

I’m happy to try to reproduce tomorrow!

the page doesn’t load, only a ‘too many redirects’ is shown. Interesting detail: if I let the port 80 forward directly to localhost:1880, WITHOUT using the /nodered/* path, then it will load node-red successfully. But this isn’t what I’m looking for, because I have multiple services that I need to access. Could it be that the balena public url doesn’t allow path handling somehow?