Skip to content

Do not send 'Origin' header in handshake #38

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

Merged
merged 1 commit into from
Dec 26, 2014

Conversation

danielwhite
Copy link
Contributor

This is a header only intended to support for Web Origin security in
browsers. Other clients are not required to include this header, and the
current case complicates servers since it receiving 'ws://' or 'ws://'
in the 'Origin' header is highly unusual.

RFC 6455, Section 4.1, Client Requirements:

Additionally, if the client is a web browser, it supplies /origin/.

RFC 6455, Section 4.2.1, Reading the Client's Opening Handshake:

Optionally, an |Origin| header field. This header field is sent by
all browser clients. A connection attempt lacking this header field
SHOULD NOT be interpreted as coming from a browser client.

This is a header only intended to support for Web Origin security in
browsers. Other clients are not required to include this header, and the
current case complicates servers since it receiving 'ws://' or 'ws://'
in the 'Origin' header is highly unusual.

RFC 6455, Section 4.1, Client Requirements:

> Additionally, if the client is a web browser, it supplies /origin/.

RFC 6455, Section 4.2.1, Reading the Client's Opening Handshake:

> Optionally, an |Origin| header field.  This header field is sent by
> all browser clients.  A connection attempt lacking this header field
> SHOULD NOT be interpreted as coming from a browser client.
jeremyong added a commit that referenced this pull request Dec 26, 2014
Do not send 'Origin' header in handshake
@jeremyong jeremyong merged commit 48c1186 into jeremyong:master Dec 26, 2014
@aeden
Copy link
Contributor

aeden commented Dec 28, 2014

@jeremyong FWIW, this commit causes issues with older versions of the Go websocket implementation. It manifests as "normal" EXIT messages whenever attempting to connect.

I'm going to attempt an upgrade to the latest Go websocket server implementation at https://godoc.org/golang.org/x/net/websocket and see if that resolves the issue.

@aeden
Copy link
Contributor

aeden commented Dec 28, 2014

I just tested against the latest Go websocket implementation, and it still fails. 🐼

@aeden
Copy link
Contributor

aeden commented Dec 28, 2014

It looks like the default HTTP server implementation that comes with the Go Websocket library always checks the Origin header: https://github.com/golang/net/blob/master/websocket/server.go#L93-L99

Next thing to try is to create a server which doesn't check origin, since in this particular I do not use browsers as clients.

@aeden
Copy link
Contributor

aeden commented Dec 28, 2014

This StackOverflow response provided the solution: http://stackoverflow.com/a/23324279/1592455 (in case anyone else needs it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants