1. The problem I’m having:
I’m trying to replace my nginx server with caddy to server my ui service. I tried to add everything I have nginx.conf to my caddyfile. When I deploy my changes to QA, the browser returns no response for me. I can’t see where the error can be or related to what. I’m using docker to build my app and set the caddy server up
2. Error messages and/or full log output:
3. Caddy version:
v2.7.4
4. How I installed and ran Caddy:
a. System environment:
Docker
b. Command:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
c. Service/unit/compose file:
Docker file
# Stage 1
FROM node:18 as react-build
WORKDIR /app
COPY . ./
ENV NODE_OPTIONS="--max-old-space-size=8192"
RUN curl -u packurl
RUN yarn
RUN yarn build
# Stage 2 - the production environment
FROM caddy:latest
COPY --from=react-build /app/dist /usr/share/caddy/html
COPY Caddyfile /etc/caddy/Caddyfile
EXPOSE 8080
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
d. My complete Caddy config:
{
http_port 8080
}
localhost:8080 {
root * /usr/share/caddy/html
file_server
metrics /prometheus
header {
X-XSS-Protection "1; mode=block"
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Frame-Options SAMEORIGIN
X-Content-Type-Options nosniff
Content-Security-Policy "frame-ancestors 'none'"
Access-Control-Allow-Origin "*"
Access-Control-Allow-Credentials true
Access-Control-Allow-Methods "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK, PROPFIND, MKCOL"
Access-Control-Allow-Headers "Authorization,DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Accept-Charset,X-Accept,origin,accept,if-match,destination,overwrite,X-CustomHeader"
}
# Handle /health endpoint
route /health {
respond "UP"
}
}