Send Origin Header with websocket handshake

Get help using Construct 2

Post » Fri Oct 30, 2015 1:47 am

Not really sure where to put this, @Kyatric would you kindly move this where appropriate,

Anyways, I'm coding a webserver in Golang that will hopefully handle websocket communication, and I think I hit a wall: the Origin Header is incorrect or not sent by the ws-plugin during the handshake, right now, I'm completely ignoring the Origin to make it work, but I'd love if @Ashley confirmed that the header is sent properly by the websocket plugin
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Fri Oct 30, 2015 12:58 pm

AFAIK the browser assigns the Origin header and it's not possible to change it from Javascript for security reasons. What exactly are you seeing with this header and is it consistent across browsers?
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Fri Oct 30, 2015 3:25 pm

@Ashley, I'm trying to start a websocket connection to my server from a localhost preview, but that server is giving me back, Error: Origin not allowed, is it because I'm running from localhost? I think so, I'll check when i have time to.
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Fri Oct 30, 2015 4:29 pm

Nvm, It's on the server-side, and it's fixed
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Fri Oct 30, 2015 7:02 pm

Probably CORS again, guessing you need to set Access-Control-Allow-Origin. (Guessing you figured this out but posting for searchers)
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Sat Oct 31, 2015 1:38 pm

@Ashley, yeah, I properly get the origin header but I don't handle it, so the connection closes abruptely
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461


Return to How do I....?

Who is online

Users browsing this forum: evillair, unicornspitfire and 13 guests