Files
Maxence MaireauxandGitHub 1e1aa05f8c fix(local): Gateway error in config (#593)
* fix: use valide caddyfile

* feat: change name
2025-11-17 14:50:42 +00:00

69 lines
1.3 KiB
Caddyfile

(cors) {
header {
Access-Control-Allow-Methods "GET,OPTIONS,PUT,POST,DELETE,HEAD,PATCH"
Access-Control-Allow-Headers content-type
Access-Control-Max-Age 100
Access-Control-Allow-Origin *
}
}
(handle_path_route_with_auth) {
# handle_path automatically strips the prefix from the request path
handle_path {args.0}* {
reverse_proxy {args.1}
import cors
}
}
(handle_path_route_without_auth) {
# handle_path automatically strips the prefix from the request path
handle_path {args.0}* {
reverse_proxy {args.1}
import cors
}
}
{
# Many directives manipulate the HTTP handler chain and the order in which
# those directives are evaluated matters. So the jwtauth directive must be
# ordered.
# c.f. https://caddyserver.com/docs/caddyfile/directives#directive-order
order versions after metrics
order audit after encode
# Local env dev config
debug
}
:80 {
tracing {
span gateway
}
import handle_path_route_without_auth "/api/payments" "payments:8080"
handle /versions {
versions {
region "local"
env "local"
endpoints {
payments {
http://payments:8080/_info http://payments:8080/_healthcheck
}
}
}
}
handle /api/* {
respond "Bad Gateway" 502
}
# handle all other requests
handle {
reverse_proxy 127.0.0.1:3000
import cors
}
}