WebSocket handshake: Unexpected response code: 403

  • Grafana version 10.4.2

  • I want to create proxy that use localhost:8050/grafana forward to localhost:3000

  • I got error with websocket: WebSocket handshake: Unexpected response code: 403

  • I expected when I use url: localhost:8050/grafana then it will show dashboard and web page of grafana.

  • Below is the configuration that I used:

  • [server]
    protocol = http
    http_port = 3000
    domain = localhost
    root_url = http://localhost:8050/grafana/
    serve_from_sub_path = true
    
    [security]
    allow_embedding = true
    
    [log]
    level = debug
    

    In Fastapi that I config I got:

  • INFO:     127.0.0.1:55504 - "WebSocket /api/live/ws" 403
    INFO:     connection rejected (403 Forbidden)
    INFO:     connection closed
    

So that looks like your “proxy” is proxying it wrong, when Grafana responds with 404 response and it doesn’t proxying websockets properly when websocket request is responding with 403 response.

Try some better, well documented proxy:

1 Like