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
44
S
18
G
17
Posts: 2,249
Reputation: 17,585

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
415
S
248
G
92
Posts: 25,295
Reputation: 200,984

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
44
S
18
G
17
Posts: 2,249
Reputation: 17,585

Post » Fri Oct 30, 2015 4:29 pm

Nvm, It's on the server-side, and it's fixed
B
44
S
18
G
17
Posts: 2,249
Reputation: 17,585

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
415
S
248
G
92
Posts: 25,295
Reputation: 200,984

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
44
S
18
G
17
Posts: 2,249
Reputation: 17,585


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], GloryF90 and 4 guests