LoginSignup
4
3

More than 3 years have passed since last update.

FirefoxでhttpsからWebSocket接続(ws)するにはnetwork.websocket.allowInsecureFromHTTPS

Posted at

結論

実行するページがhttpsなら
network.websocket.allowInsecureFromHTTPS
trueに変更する。


自分用タイトル:UserScriptからlocalhostにWebSocket接続(ws)するにはallowInsecureFromHTTPS

UserScriptだからといってローカルへのWebSocket接続に制限はなさそう。

起こったエラー

UserScriptで

const socket = new WebSocket('ws://127.0.0.1:1234');
としたときに

ERROR: Execution of script 'スクリプト名' failed! The operation is insecure.

と出力される。
プロトコルをwssに変更すればエラーは出ないが、今回はサーバー側が対応してなかったのでwsで動かしたかった。

UserScript特有のセキュリティーかと考えていたが、違ったよう。
UserScriptで検索も上手くいかず、Firefoxを検索ワードにしないとたどり着けなかった。

情報源

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3