After some test, seems that I solved the API errors, but non the ones related to api/websocket.
For example, now I can connect to HA for example with: curl -X GET -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI...." -H "Content-Type: application/json" http://192.168.1.25:8123/api/states
but still remains the issues with api/websocket call as reported in Nginx Report:
2024/01/23 18:31:28 [error] 152#152: *34 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:29 [error] 152#152: *36 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:31 [error] 152#152: *38 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:34 [error] 152#152: *40 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:38 [error] 152#152: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:43 [error] 152#152: *44 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:48 [error] 152#152: *46 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:54 [error] 152#152: *48 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:31:59 [error] 152#152: *50 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:32:04 [error] 152#152: *52 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
2024/01/23 18:32:09 [error] 152#152: *54 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: my.duckdns.org, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.1.25:8123/api/websocket", host: "my.duckdns.org"
My actual config is:
location /api {
proxy_pass http://192.168.1.25:8123;
proxy_set_header Host $host;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /api/websocket {
proxy_pass http://192.168.1.25:8123/api/websocket;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
In this scenario Google TTS cache the audio files in /tts folder but doesn’t cast to the media player:
Failed to cast media https://192.168.1.25:8123/api/tts_proxy/ade1bdbf603d24c75cc63914aafcff899f705859_it_-_tts.google_it_it.mp3 from internal_url (https://192.168.1.25:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address