Skip to content

Error when copying from client to backend: websocket: close 1006 (abnormal closure): unexpected EOF #39

Open

Description

@Haomeng

I just encountered below error message, looks like the wss connection is closed after dial successfully:

2020/10/19 17:25:43 websocketproxy: Error when copying from client to backend: websocket: close 1006 (abnormal closure): unexpected EOF
2020/10/19 17:25:43 http: response.WriteHeader on hijacked connection from huayun.com/haihe/bare-metal-vnc/src/websocketproxy.(*WebsocketProxy).ServeHTTP.func1 (websocket_proxy.go:130)

Note:
connBackend, resp, err := dialer.Dial(backend.Url.String(), requestHeader)
This line works fine, err is nil.

So any ideas, thans a lot!

Activity

  1. alfrye commented on Jun 30, 2021

    @alfrye

    I am experiencing the same issues. Are there any updates on this issue?

  2. feiyiban commented on Mar 30, 2022

    @feiyiban

    I am experiencing the same issues. Are there any updates on this issue?

  3. mpisat commented on Jun 25, 2022

    @mpisat

    Same here...

  4. Egr711 commented on Oct 27, 2023

    @Egr711

    In my case, needed to copy response headers after dialing.

            # websocketproxy.go
            connBackend, resp, err := dialer.Dial(backendURL.String(), requestHeader)
    	if err = wsCopyResponse(resp, respBackend); err != nil {
    		errorF(w.option.logger, "websocketproxy: couldn't copy response: %v", err)
    	}
    
  5. Egr711 commented on Oct 8, 2025

    @Egr711

    if youre using net/http you can just use httputil.NewSingleHostReverseProxy instead of this package. websocket support was added in 2019 with Go 1.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions