Hello I am also having this issue (Websocket error) with a docker installation :
- chirpstack-application-server 3.16
- redis 6.2.5
- Firefox 91.0.1
For simulation I use the chirpstack-simulator for creating gateways and devices.
I use a Nginx proxy and HAProxy Load balancer with the following operation : Client_ws <->Haproxy_ws_proxy <-> Nginx_ws_proxy <-> Chirpstack_ws_server. Here are my configuration files :
##haproxy.cfg :
defaults
mode tcp
log global
option httplog
option dontlognull
option http-server-close
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 10m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen stats
bind *:7777
mode http
stats enable
stats hide-version
stats realm HAproxy-Statistics
stats uri /
timeout client 25s
timeout connect 5s
timeout server 25s
# timeout tunnel available in ALOHA 5.5 or HAProxy 1.5-dev10 and higher
timeout tunnel 3600s
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend Web_80
bind *:80
mode http
default_backend www
http-request redirect scheme https unless { ssl_fc }
#Redirect to Nginx proxy
frontend WebSSL_443
bind *:443 ssl crt ********
rspadd Strict-Transport-Security:\ max-age=15768000
# mode http
# routing based on websocket protocol header
acl hdr_connection_upgrade hdr(Connection) -i upgrade
acl hdr_upgrade_websocket hdr(Upgrade) -i websocket
use_backend nginx0001_ws if hdr_connection_upgrade hdr_upgrade_websocket
default_backend nginx0001
backend nginx0001
mode http
option forwardfor
balance roundrobin
server nginx0001 127.X.X.X:8080 check
timeout connect 5s
timeout server 25s
# timeout tunnel available in ALOHA 5.5 or HAProxy 1.5-dev10 and higher
timeout tunnel 3600s
http-request set-header X-Forwarded-Host %[req.hdr(Host)]
http-request set-header X-Client-IP %[src]
backend nginx0001_ws
balance roundrobin
server nginx0001 127.X.X.X:8080 check
timeout connect 10s
timeout server 25s
# timeout tunnel available in ALOHA 5.5 or HAProxy 1.5-dev10 and higher
timeout tunnel 3600s
option forwardfor
Configuration according to the official documentation.
## nginx.conf
upstream chirpstack{
server 172.X.X.X:8080;
}
server {
listen 8080;
server_name chirpstack.example.org;
location ~ ^/api/(gateways|devices)/(\w+)/(frames|events)$ {
proxy_pass http://chirpstack/api/$1/$2/$3;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log /var/log/nginx/lns_ws.access.log;
error_log /var/log/nginx/lns_ws.error.log;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
location / {
proxy_pass http://chirpstack;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log /var/log/nginx/lns.access.log;
error_log /var/log/nginx/lns.error.log;
}
}
Configuration according to the official documentation.
I’m still getting the error :
time="2021-08-23T08:50:34.144276849Z" level=info msg="finished streaming call with code Unauthenticated" error="rpc error: code = Unauthenticated desc = authentication failed: get token from context error: no authorization-data in metadata" grpc.code=Unauthenticated grpc.method=StreamFrameLogs grpc.service=api.GatewayService grpc.start_time="2021-08-23T08:50:34Z" grpc.time_ms=0.102 peer.address="127.0.0.1:57363" span.kind=server system=grpc
Could you help me please ?
