31 lines
388 B
Bash
31 lines
388 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
echo "Starting Caddy with backend URL: ${BACKEND_URL}"
|
|
|
|
cat << EOF | tee /etc/caddy/Caddyfile
|
|
{
|
|
auto_https off
|
|
local_certs
|
|
skip_install_trust
|
|
http_port 3000
|
|
}
|
|
|
|
http:// {
|
|
encode gzip zstd
|
|
|
|
handle_path /api/* {
|
|
reverse_proxy ${BACKEND_URL}
|
|
}
|
|
|
|
handle {
|
|
root * /www
|
|
try_files {path} /index.html
|
|
file_server
|
|
}
|
|
|
|
}
|
|
EOF
|
|
caddy run --config /etc/caddy/Caddyfile
|