1. The problem I’m having:
when I try my container (there is a caddy server and a react frontend) locally with localhost:80 , I have no problem but in K8S under an ingress ( aws load balancer ) I have a problem :
I can curl from internet the pod
curl https://mywebsite.io/project_A/
BUT it show an empty page ( blank )
and the firefox console show errors
GET
https://mywebsite.io.io/static/js/main.acbe4637.js
[HTTP/2 503 Service Unavailable 4ms]
GET
https://mywebsite.io.io/static/css/main.acb135df.css
[HTTP/2 503 Service Unavailable 4ms]
Loading failed for the <script> with source “https://mywebsite.io.io/static/js/main.acbe4637.js”. behavior:1:460
GET
https://mywebsite.io.io/logo192.png
[HTTP/2 503 Service Unavailable 0ms]
GET
https://mywebsite.io.io/favicon.ico
[HTTP/2 503 Service Unavailable 0ms]
but if I manually curl the https://mywebsite.io/project_A/logo192.png it work ( show the react logo )
so all the urls are missing the prefix_path , how can I solve this ? thank you
2. Error messages and/or full log output:
no error in the logs of the container
3. Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
using the docker image caddy:alpine
a. System environment:
EKS 1.26
b. Command:
no custom of the entrypoint of the caddy:alpine container
c. Service/unit/compose file:
d. My complete Caddy config:
{
auto_https disable_redirects
}
:80 {
handle_path /api/* {
reverse_proxy {$BACKEND_API_HOSTNAME}:{$BACKEND_API_PORT} {
header_up Host {upstream_hostport}
header_up X-Real-IP {remote_addr}
header_up X-Forwarded-Host {host}
}
}
handle {
rewrite * /project_A/{uri}
root * /usr/share/caddy/
try_files {path} {file} /index.html
file_server
}
}
it look like that the line
rewrite * /project_A/{uri}
is incorrect or not working , thank you for the help