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

Missleading origin error message #247

Closed
laliluna opened this issue Jun 3, 2020 · 1 comment
Closed

Missleading origin error message #247

laliluna opened this issue Jun 3, 2020 · 1 comment
Milestone

Comments

@laliluna
Copy link

laliluna commented Jun 3, 2020

When a proxy does not correctly set the origin, I found the error message is missleading.

I got
Accept failed: failed to accept WebSocket connection: request Origin "http://localhost:5555" is not authorized for Host "localhost:9000"

so I introduced
OriginPatterns: []string{"http://localhost:5555"},

But the code is expecting the origin without the trailling http://

The error message in authenticateOrigin could use the value, it is actually checking, ie. u.Host instead of origin

return fmt.Errorf("request Origin %q is not authorized for Host %q", origin, r.Host)

Cheers Sebastian

@nhooyr
Copy link
Contributor

nhooyr commented Jun 3, 2020

Great catch!

The error message should be fixed to print just the host.

@nhooyr nhooyr added this to the v1.8.7 milestone Jul 5, 2020
nhooyr added a commit that referenced this issue Jan 9, 2021
@nhooyr nhooyr closed this as completed Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants