Is it possible to set the Origin header while creating the websocket connection

135 Views Asked by At

I have gone through some websites and found that it is not posssible to add headers while usig web socket.Is that true

I have to pass the origin header as Origin : "http://localhost:4200"

1

There are 1 best solutions below

4
Steffen Ullrich On

The Origin header is not in control of the Javascript running on a page. It is set by the browser, without control of the web application running in the browser. This is not only the case for Websockets but for any HTTP requests from the browser.