How do i fix my nodejs application using caddy as reverse proxy to render my css,javascipt files etc, which are located in the public directory

105 views Asked by At
This my cadddyfile
my.domain.com{
     route /merchant* {
        reverse_proxy merchant:5000

    } 
    route /company* {
        reverse_proxy company:6500

    }
    route /dashboard* {
        reverse_proxy dashboard:8100

    }

    route / {
        reverse_proxy client:4500

    }

}

This my docker compose file version: '3'

services: dashboard: build: context: . dockerfile: Dockerfile.dashboard container_name: dashboard ports: - "8100:8100" env_file: - .env

merchant: build: context: . dockerfile: Dockerfile.merchant container_name: merchant ports: - "5000:5000" env_file: - .env

company: build: context: . dockerfile: Dockerfile.company container_name: company ports: - "6500:6500" env_file: - .env

client: build: context: . dockerfile: Dockerfile.index container_name: index ports: - "4500:4500" env_file: - .env

caddy: image: caddy/caddy:2.2.1-alpine container_name: caddy-service restart: unless-stopped ports: - "80:80" - "443:443" volumes: - $PWD/Caddyfile:/etc/caddy/Caddyfile - $PWD/site:/srv - caddy_data:/data - caddy_config:/config

volumes: caddy_data: caddy_config:

in my servers file the middleware is defined as app.use(express.static('public))

i was exepecting when i render it in the browser the css and javascript will load but it only render the views files but the css is not loading " "

0

There are 0 answers