30

Is there any way to access the Microphone and Camera using chrome when the website is http?

I tried enabling "Insecure origins treated as secure" flag, however when the browser is closed and opened again, the domain used in this flag disappears and I have to retype and re-enable it again.

I also tried starting chrome with "--unsafely-treat-insecure-origin-as-secure=http://example.com" argument, however when this was used a message appears on Chrome saying

You are using an unsupported command line flag:--unsafely-treat-insecure-origin-as-secure=http://example.com. Stability and Security will suffer

I don't want the message to appear, so I couldn't use this technique as well.

Is there any other way to access the Microphone and Camera without getting any warnings? (I am accessing the device using WebRTC).

1
  • I was able to retain the setting on my desktop, but on mobile, I had the same problem you report. Are you using mobile? Commented Jul 18, 2019 at 2:13

2 Answers 2

57

This worked for me. Although it's for Testing purpose only.

To ignore Chrome’s secure origin policy, follow these steps. Navigate to chrome://flags/#unsafely-treat-insecure-origin-as-secure in Chrome.

Find and enable the Insecure origins treated as secure section (see below). Add any addresses you want to ignore the secure origin policy for. Remember to include the port number too (if required). Make sure to add the protocol (probably http://) to the front or the value will be lost after restarting. Save and restart Chrome.

Remember this is for dev purposes only. The live working app will need to be hosted on https for users to be able to use their microphone or camera.

"unsafely-treat-insecure-origin-as-secure" flag is not working on Chrome

Sign up to request clarification or add additional context in comments.

3 Comments

If it works this would save me crazy amount of time.
Update: This worked for me. Nifty trick.
This does no exist on iPhone!
5

You are not allowed to run webrtc on http after Chrome 47+ version, but you can do some hack for this with some changes in ngnix.cong file, as

//Make necessary changes
server {
        listen 8080;
        server_name localhost;
        location / {
            proxy_pass         http://your.dev.box.ip:8080;
        }
    }

Reference : https://webrtchacks.com/chrome-secure-origin-https/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.