Avoiding NavigatorUserMediaError “Only secure origins are allowed” on HTTP in Chrome

爱⌒轻易说出口 提交于 2019-12-01 15:42:45

The unsafely-treat-insecure-origin-as-secure flag works for me as documented here.

On OS X this looks like:

$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://alt.local:8080

For various reasons, my local development server doesn't run on localhost or port 80. Specifying the alternative port appears to be necessary.

The user-data-dir directive appears to create a temporary sandbox profile in Chrome.

Tom

According to https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features, localhost is supposed to be considered as a secure origin.

If you do not test on localhost but on a real domain, then you should enable an HTTPS access (you can get a free certificate with Let's Encrypt)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!