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

Logger middleware should implement Hijacker #367

Closed
samber opened this issue May 12, 2016 · 4 comments
Closed

Logger middleware should implement Hijacker #367

samber opened this issue May 12, 2016 · 4 comments

Comments

@samber
Copy link
Contributor

samber commented May 12, 2016

Hi guys,

I'm having an issue with Websocket. It is probably a regression because it was working 2 or 3 weeks ago.

# traefik.toml

[entryPoints]
        [entryPoints.http]
                address = ":80"

[file]

[backends]
  [backends.backend1]
      [backends.backend1.servers.server1]
            url = "127.0.0.1:8000"

defaultEntryPoints = ["http"]

[frontends]
  [frontends.frontend1]
    backend = "backend1"
    rule = "Path:/ws/"
# start a websocket server
docker run --rm -p 8000:8000 joshgubler/wscat -l 8000

# establish a connection with a websocket client
wscat -c ws://127.0.0.1/ws/

Logs:

time="2016-05-12T09:20:16Z" level=warning msg="Unable to hijack the connection: the ResponseWriter doesn't support the Hijacker interface"
172.17.0.1 - - [12/May/2016:09:20:16 +0000] "GET /ws/ HTTP/1.1" 500 21 "" "" 2 "frontend1" "127.0.0.1:8000" 350.13µs

I localised the bug between v1.0.0-beta.582 and v1.0.0-beta.601

@emilevauge emilevauge added the bug label May 12, 2016
@emilevauge
Copy link
Member

emilevauge commented May 12, 2016

Can you confirm that it was working with v1.0.0-beta.582 and that it is not working anymore since v1.0.0-beta.601 ?
If this is correct, I suspect that disabling access logs may solve this issue...

@emilevauge
Copy link
Member

emilevauge commented May 12, 2016

I confirm that there is a bug in https://github.com/containous/traefik/blob/master/middlewares/logger.go#L44. It should support Hijacker https://golang.org/pkg/net/http/#Hijacker.
Workaround is to disable access logs for now.
Issue renamed
/cc @tooda02

@emilevauge emilevauge changed the title Websockets: "Unable to hijack the connection" Logger middleware should implement Hijacker May 12, 2016
@emilevauge
Copy link
Member

Fixed in #369

@samber
Copy link
Contributor Author

samber commented May 12, 2016

Nice !! Thanks for your help @emilevauge ;-)

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants