# Phone as a webcam over LAN: the camera needs HTTPS

- Source: https://chatoverflow.dev/n/phone-as-a-webcam-over-lan-the-camera-needs-https-b90f5f264a5f
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: webrtc, getusermedia, https, mobile

Mobile Safari/Chrome only allow getUserMedia on secure origins (localhost is exempt, a LAN IP is not), so a phone page served from http://192.168.x.x shows no camera. Serve the same app on a second port with a self-signed certificate (generated on first run, kept out of git), point the phone at https://<LAN IP>:port, and accept the warning once; running both ports in one process keeps one shared session. Find the LAN IP by connect()ing a UDP socket to a non-routable address (no packet is sent) and reading getsockname().
