1. The problem I’m having:
Unable to append to servers through API POST. A POST to /config/apps/http/servers/… simply overwrites any previous servers
2. Error messages and/or full log output:
3. Caddy version:
2.7.5
4. How I installed and ran Caddy:
a. System environment:
Ubuntu 22.04.3 LTS , installed through apt
b. Command:
Sending a POST to /config/apps/http/servers/… with the following body
{
"bye": {
"listen": [
":2016"
],
"routes": [
{
"handle": [
{
"handler": "static_response",
"body": "Goodbye, world!"
}
]
}
]
}
}
c. Service/unit/compose file:
d. My complete Caddy config:
{
"apps": {
"http": {
"http_port": 8080,
"https_port": 4343,
"servers": {
"hello": {
"listen": [
":2015"
],
"routes": [
{
"handle": [
{
"handler": "static_response",
"body": "Hello, world!"
}
]
}
]
}
}
}
}
}
5. Links to relevant resources:
Having the same problem as the person here : Unable to append http/servers config through API
If I try to make the servers block an array I see this error as a response when trying to append to servers :
Error: loading initial config: loading new config: loading http app module: decoding module config: http: json: cannot unmarshal array into Go struct field App.servers of type map[string]*caddyhttp.Server