When setting header in websocket
wscat -c ws://localhost:3001 -H 'Authorization: Bearer ey~' -H 'test: test'
Header info does not included in event
"headers": {
"Host": "localhost",
"Sec-WebSocket-Extensions": "permessage-deflate; client_max_window_bits",
"Sec-WebSocket-Key": "cjy9etsni0001unlr2opae5yr",
"Sec-WebSocket-Version": "13",
"X-Amzn-Trace-Id": "Root=cjy9etsni0002unlr3q1w0hgd",
"X-Forwarded-For": "127.0.0.1",
"X-Forwarded-Port": "3001",
"X-Forwarded-Proto": "http"
},
In aws apigateway environment, it return header value like this
"headers": {
"Authorization": "Bearer ey~",
"Host": "~.execute-api.us-east-1.amazonaws.com",
"Sec-WebSocket-Extensions": "permessage-deflate; client_max_window_bits",
"Sec-WebSocket-Key": "~",
"Sec-WebSocket-Version": "13",
"test": "test",
"X-Amzn-Trace-Id": "Root=1-5d311b89-6c658e582f641e616d4df73e",
"X-Forwarded-For": "~",
"X-Forwarded-Port": "443",
"X-Forwarded-Proto": "https"
},
hey @yareyaredesuyo thank you for creating the issue! this is very likely not yet implemented, but will be hopefully soon.
@yareyaredesuyo @dnalborczyk
Here's an output of event.headers when running wscat -c ws://localhost:3001 -H 'Authorization: Bearer ey~' -H 'test: test':
{
'Sec-WebSocket-Version': '13',
'Sec-WebSocket-Key': 'c2uJgXnsCDwux1TvouckqQ==',
Authorization: 'Bearer ey~',
test: 'test',
'Sec-WebSocket-Extensions': 'permessage-deflate; client_max_window_bits',
Host: 'localhost:3001',
'user-agent': 'shot',
'X-Forwarded-For': '127.0.0.1',
'X-Amzn-Trace-Id': 'Root=cjyvzg3af0000llcbf82jbuzm',
'X-Forwarded-Port': '3001',
'X-Forwarded-Proto': 'http'
}
@yareyaredesuyo
although https://github.com/dherault/serverless-offline/pull/732 hasn't been merged in yet, the header values should be accessible in the latest v6-alpha releases.
could you confirm @computerpunc ?
could you confirm @computerpunc ?
@dnalborczyk
I confirm.
Alpha passes the test should be able to get headers in connect
Most helpful comment
@yareyaredesuyo @dnalborczyk
732 already fixes this issue.
Here's an output of
event.headerswhen runningwscat -c ws://localhost:3001 -H 'Authorization: Bearer ey~' -H 'test: test':