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