Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Close websocket conneciton in case of unauthorised request #1526

Open
vipul-rawat opened this issue Feb 25, 2025 · 0 comments · May be fixed by #1530
Open

Cannot Close websocket conneciton in case of unauthorised request #1526

vipul-rawat opened this issue Feb 25, 2025 · 0 comments · May be fixed by #1530
Labels
bug Something isn't working

Comments

@vipul-rawat
Copy link
Member

Describe the bug
I have validations set for my server to authorise users based on Bearer tokens, when using the websocket, The server is showing connection successfull and I get error logs for connection highjack because I am writing 401 errors to the response writter.

Even If I ignore the un-authorized request and not move forward, the connection remains open.

To Reproduce
Add a middleware which returns and writes to the http.ResponseWriter and hijack can be reproduced.
Check for authorization and return without calling inner.ServeHTTP(w,r), the connection to websocket remains open.

  1. The code is

  2. The error is

    
    

Expected behavior
I should be able to get the connection in middleware for the particular websocket request and close connection in case of unauthorised request

Screenshots
If applicable, add screenshots to help explain your problem.

Environments (please complete the following information):

  • OS: [e.g. Linux]
  • gofr version [e.g. v1.5.0]
  • go version [e.g. 1.21]

More description
Add any other context about the problem here.

@vipul-rawat vipul-rawat added the bug Something isn't working label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant