Skip to content

websocket protocol: 'upgrade' token not found in 'Connection' header" #263

@w33dw0r7d

Description

@w33dw0r7d

I build outline with caddy from commit: 5522935
And run inside container with config:

---
logging:
  logs:
    default:
      level: "INFO"
      encoder:
        format: console
apps:
  http:
    servers:
      "HOSTNAME":
        listen:
          - :443
        routes:
          - match:
              - host:
                - HOSTNAME
              - path:
                - /PATH/tcp
            handle:
              - handler: websocket2layer4
                type: stream
                connection_handler: ss1
          - match:
              - host:
                -  HOSTNAME
              - path:
                - /PATH/udp
            handle:
              - handler: websocket2layer4
                type: packet
                connection_handler: ss1

        trusted_proxies:
          source: static
          ranges:
            - 127.0.0.1
            - ::1
        client_ip_headers:
          - "X-Forwarded-For"
          - "X-Original-Forwarded-For"
          - "Forwarded-For"
          - "Forwarded"
          - "Client-IP"
          - "CF-Connecting-IP"
          - "X-Real-IP"
          - "X-Client-IP"
          - "True-Client-IP"

  layer4:
    servers:
      "1":
        listen:
          - "tcp/127.0.0.1:9000"
          - "udp/127.0.0.1:9000"
        routes:
          - handle:
              - handler: outline
                connection_handler: ss1
  outline:
    shadowsocks:
      replay_history: 10000
    connection_handlers:
      - name: ss1
        handle:
          handler: shadowsocks
          keys:
            - id: USER
              cipher: chacha20-ietf-poly1305
              secret: PASSWD

all work but sometimes i have a connection issue. Server throw this in logs:

2025/08/01 12:37:01.807 ERROR    http.handlers.websocket2layer4  failed to upgrade       {"err": "websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header"}
github.com/Jigsaw-Code/outline-ss-server/outlinecaddy.WebSocketHandler.ServeHTTP
        github.com/Jigsaw-Code/outline-ss-server/[email protected]/websocket2layer4_handler.go:124
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/routes.go:331
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/caddyhttp.go:74
github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/routes.go:298
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/caddyhttp.go:74
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/server.go:481
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func2
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/server.go:457
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/caddyhttp.go:74
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP
        github.com/caddyserver/caddy/[email protected]/modules/caddyhttp/server.go:370
net/http.serverHandler.ServeHTTP
        net/http/server.go:3301
net/http.(*conn).serve
        net/http/server.go:2102

Client on iOS Version 1.15.2 (484997)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions