Need help with serving the bundled script of React.js

1. Bundled script and css of React.js files keeps loading, script that resides inside the head tag of html file. Below is the setup.

**Dockerfile:**
// Stage 1: Build React application
...

// Stage 2: Serve React application with Caddy
FROM caddy:latest
COPY --from=build /app/frontend/dist /srv
`
**docker-compose.yml**

version: "3.9"
services:
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    restart: always
    image: caddy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./frontend/caddy/Caddyfile:/etc/caddy/Caddyfile
**Caddyfile**
{
    email ####@###.com
    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
    servers {
        timeouts {
                read_body   2m
                read_header 2m
                write       2m
                idle        5m
        }
    }
}

####.####.com {

    #api
    handle /api/* {
        reverse_proxy backendapi:3000 {
            transport http {
                read_timeout 1m
                write_timeout 1m
            }
        }
    }

    # react app
    handle /* {
        root * /srv
        file_server 
        try_files {path} /index.html
    }
}

3. Caddy version:

Caddy version v2.6.4

a. System environment:

Os- Linux

Please completely fill out the help topic template, as per the forum rules. DO NOT remove any sections. You haven’t explained what isn’t working. Show logs, show an example request with curl -v.

Also, please review the docs for our recommendations for Docker compose, there’s problems in your config Keep Caddy Running — Caddy Documentation

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.