Access docker application behind caddy

43 views Asked by At

I have a notes application with a frontend and a backend running on docker on my raspberry pi 3.

I reach it on my local network pi address, on the port 8080 -> 192.168.1.185:8080

I also run adguard on the port 8083.

I would like to use caddy to access both applications without specifying the port number, like so : 192.168.1.185/notes -> notes application

192.168.1.185/adguard -> adguard application

Here is my Caddyfile :

:80 {
  route /notes* {
    uri strip_prefix /notes
    reverse_proxy http://192.168.1.185:8080
  }

  route /adguard* {
    uri strip_prefix /adguard
    reverse_proxy http://192.168.1.185:8083
  }
  log {
    level DEBUG
  }
}

I can access to adguard properly, but when I reach 192.168.1.185/notes, I get a white page. I precise that my notes app is working fine on 192.168.1.185:8080

Here is my docker-compose.yml file :

version: '3'

services:
  notes-backend:
    build:
      context: .
    ports:
      - "8000:8000"
    volumes:
      - ./database.db:/database.db
    depends_on:
      - notes-frontend
    restart: unless-stopped 
  notes-frontend:
    build:
      context: ../notes-frontend
    ports:
      - "8080:8080"
    environment:
      - VUE_APP_BACKEND_URL=http://notes-backend:8000
    restart: unless-stopped
volumes:
  database-volume:

Is there something I miss here and is it the proper way to run multiple services simultaneously ?

0

There are 0 answers