I do not know, where the error was, but now caddy works locally with the following settings
caddy.local {
handle /ws {
reverse_proxy fastapi.local:8000 {
}
}
handle {
reverse_proxy fastapi.local:8000
}
}
I will test on my production server one of these days.
Thank you