创建websocket时如何在Header中禁用cookie? [英] How to disable cookies in Header while creating websocket?
问题描述
在客户端上创建WebSocket时,浏览器还会发送带有Headers的cookie.有没有一种方法可以禁用此行为.
While creating WebSocket on client side, browser also sends cookies with Headers. Is there are a way to disable this behavior.
我阅读了Mozilla Dev Net上的WebSocket文档( https://developer.mozilla.org/zh-CN/docs/Web/API/WebSocket ),但找不到任何可对此进行评级的文档.
I read WebSocket documentation on Mozilla Dev Net (https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) but couldn't find any documentation regrading this.
推荐答案
不,没有办法.
如果websocket服务器在另一个域中,则不会发送Cookie.或者,如果它们在另一个子域中,但该子域中不允许使用cookie.
Cookies won't be send if the websocket server is in another domain. Or if they are in another subdomain but the cookie is not allowed in subdomains.
这篇关于创建websocket时如何在Header中禁用cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!