mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
69 lines
1.3 KiB
Caddyfile
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
|
|
}
|
|
}
|