Files
sonr/config/caddy/caddy.json
T

142 lines
4.2 KiB
JSON
Raw Normal View History

2024-09-19 02:04:22 -04:00
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"vault.sonr.id"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "headers",
"response": {
"replace": {
"Content-Type": [
{
"replace": "application/wasm",
"search_regexp": ".wasm"
}
]
},
"set": {
"Service-Worker-Allowed": [
"/"
]
}
}
},
{
"encodings": {
"gzip": {},
"zstd": {}
},
"handler": "encode",
"prefer": [
"zstd",
"gzip"
]
}
]
},
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "rewrite",
"uri_substring": [
{
"find": "/{http.regexp.vaultPath.0}",
"replace": "/ipns/{http.regexp.vaultPath.1}{http.regexp.vaultPath.2}"
}
]
},
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "localhost:8080"
}
]
}
]
}
]
}
],
"match": [
{
"path_regexp": {
"name": "vaultPath",
"pattern": "^/([a-z0-9]{42})(/.*|)$"
}
}
]
},
{
"handle": [
{
"handler": "file_server",
"hide": [
"./Caddyfile"
]
}
]
}
]
}
],
"terminal": true
}
]
}
}
},
"tls": {
"automation": {
"policies": [
{
"subjects": [
"vault.sonr.id"
],
"issuers": [
{
"challenges": {
"dns": {
"provider": {
"api_token": "{env.CLOUDFLARE_API_TOKEN}",
"name": "cloudflare"
},
"resolvers": [
"1.1.1.1"
]
}
},
"email": "team@sonr.id",
"module": "acme"
}
]
}
]
}
}
}
}