1. Caddy version (caddy version
):
v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
2. How I run Caddy:
I run caddy pretty basic. All there is are two rules.
All other rules are getting dynamically added through a bash script
curl "http://localhost:2019/config/apps/http/servers/srv0/routes/0" -X PUT \
-H "Content-Type: application/json" \
-d '{
"@id": "'"$CLIENT"'-'"$EMP"'",
"handle":[
{
"handler":"subroute",
"routes":[
{
"handle":[
{
"handler":"reverse_proxy",
"upstreams":[
{
"dial":"127.0.0.1:'"$PORT"'"
}
]
}
]
}
]
}
],
"match":[
{
"host":[
"'"$CLIENT"'.'"$EMP"'.reptoxx.de"
]
}
],
"terminal":true
}'
a. System environment:
Ubuntu 20.04, xcaddy installed with systemd.
b. Command:
curl http://localhost:2019/config/
c. Service/unit/compose file:
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
swing-test.reptoxx.de {
basicauth * {
reptoxx <i'm not allowed to share that>
}
reverse_proxy {
to https://127.0.0.1:9081
header_up Host {host}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
transport http {
versions 1.1
tls_insecure_skip_verify
}
}
}
*.*.reptoxx.de {
log {
output stdout
format console
level debug
}
tls {
on_demand
}
respond "test"
}
3. The problem I’m having:
The API is getting unresponsive once a websocket connection is established. So once i open up the socket through swing-test, i can’t query the api anymore.
4. Error messages and/or full log output:
$ curl -v http://localhost:2019/config/
* Trying 127.0.0.1:2019...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 2019 (#0)
> GET /config/ HTTP/1.1
> Host: localhost:2019
> User-Agent: curl/7.68.0
> Accept: */*
>
{"level":"info","ts":1637242972.0179756,"logger":"admin.api","msg":"received request","method":"GET","host":"localhost:2019","uri":"/config/","remote_addr":"127.0.0.1:51284","headers":{"Accept":["*/*"],"User-Agent":["curl/7.68.0"]}}
5. What I already tried:
I often just restart caddy to the point of it having no routes anymore. Then i can add a couple more, that i needed and after that establishing the websocket again.
I also tried to debug the issue, but the fact that it’s not responding at all, i don’t know where to start.