LoginSignup
19
11

More than 3 years have passed since last update.

“unsafely-treat-insecure-origin-as-secure” の設定をGUIで行う方法について

Posted at

現在地把握のためのメソッドgetCurrentPosition()を含む処理を久しぶりに修正する事になったので、開発環境で検証しようとしたところ以下のようなメッセージがコンソールに表示された。

Chromeのconsole画面に表示されたメッセージ
getCurrentPosition() and watchPosition() no longer work on insecure origins.
To use this feature, you should consider switching your application to a 
secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins 
for more details.

ローカルでの開発環境だと当然https対応していないので、別の方法を色々と調査したところ、ターミナルを開いて以下のようなコマンドを実行するという情報が見つかった

open -a "/Applications/Google Chrome.app" --args  --unsafely-treat-insecure-origin-as-secure="http://localhost/" http://localhost/

※参考:
* https://egashira.jp/treat-localhost-as-secure
* https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins

詳細は分からないが、CUIベースでの対応方法だと、自分のPCでは動作しなかった。
そこで、GUIベースでの対応方法を調査し、対応方法を見つける事ができた。

GUIでの“unsafely-treat-insecure-origin-as-secure”設定方法

以下2ステップで対応するだけという、非常に簡単な対応で済みます。

  1. Chromeのアドレスバーに chrome://flags/#unsafely-treat-insecure-origin-as-secure と入力する

  2. secureな環境と偽装させたいURLを、insecure origins as secureという欄に入力してEnabledにする

7da844534682551a774e8c001eae3a3d.png

意外と、ここら辺の情報がなかったので、方法が分かって良かった。。。

19
11
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
19
11