Hi,
how can i redirect all domains
domain.tls to www.domain.tls using JSON Config
1. Caddy version (v2.2.1
):
2. How I run Caddy:
using api http://127.0.0.1:2019/config/
a. System environment:
ubuntu 18
b. Command:
curl --header "Content-Type: application/json" \
--request PATCH \
--data '{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [":443"],
"routes": [
{"match": [{"host": ["domain1.tls"]}],"handle": [{"handler": "file_server","root": "/path/to/domain1.tls"}]},
{"match": [{"host": ["domain2.tls"]}],"handle": [{"handler": "file_server","root": "/path/to/domain2.tls"}]}
]
}
}
}
}
}' \
http://localhost:2019/config/
d. My complete Caddyfile or JSON config:
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [":443"],
"routes": [
{"match": [{"host": ["domain1.tls"]}],"handle": [{"handler": "file_server","root": "/path/to/domain1.tls"}]},
{"match": [{"host": ["domain2.tls"]}],"handle": [{"handler": "file_server","root": "/path/to/domain2.tls"}]}
]
}
}
}
}
}
Thank you for your help.