localhost 和 192.168.x.x 通过 HTTPS 用于框架 webVR 开发和本地测试 [英] localhost and 192.168.x.x over HTTPS for a-frame webVR development and local testing
问题描述
我正在尝试开发基于 A 帧的 VR 体验.
I'm trying to develop a A-frame-based VR experience.
我可以通过 http://localhost
在我的 mac 上进行测试,但不能通过 http://192.168.1.123
使用手机或 VR 耳机进行相同的测试>.
I can test it on my mac via http://localhost
but can't do the same using mobile phone or VR headset via http://192.168.1.123
.
问题在于,这些浏览器要求通过 HTTPS
而不是 HTTP
提供页面,否则会拒绝访问设备运动传感器,从而无法进行测试.
The problem is that those browsers demand that the page is served over HTTPS
rather than HTTP
, otherwise it denies access to the device motion sensor, making testing impossible.
按照以下说明,我成功地让我的 VR 网页使用了有效证书.
Using the following instructions, I managed to successfully have my VR web page served over with a valid certificate.
- https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/
- https://github.com/mattdesl/budo/blob/master/docs/command-line-usage.md#ssl-and-https
但是,这还不够,移动设备和耳机通过像 192.168.1.123
这样的本地 wifi IP 访问页面而不是 localhost,而且 ssl 证书似乎不适用于那些,即使我在生成域密钥时将 localhost
替换为正确的 IP证书.
But, that is not enough, mobile device and headset access the page over a local-wifi IP like 192.168.1.123
rather than localhost and the ssl certificate doesn't seem to work for those, even if i replace localhost
by the correct IP when generating the domain key & certificates.
我猜每个设备浏览器都需要更新其受信任的商店或其他东西...
i guess each device browser would need to have its trusted store updated or something...
很想知道人们如何在他们的 a-frame 本地开发和测试流程中解决他们的问题.
Would be curious to know how people solved their problem in their a-frame local development and testing flow.
推荐答案
部分答案——至少适用于 Oculus Quest 或 Go 浏览器开发.
Partial answer -- for Oculus Quest or Go browser development at least.
您可以使用 Chrome 远程设备调试工具:https://developer.oculus.com/documentation/oculus-browser/browser-remote-debugging/
You can use the Chrome remote device debugging tools: https://developer.oculus.com/documentation/oculus-browser/browser-remote-debugging/
然后为远程设备设置端口转发:https://developers.google.com/web/工具/chrome-devtools/远程调试/本地服务器
Then setup port forwarding for the remote device: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server
这种方法允许您避开整个证书的事情,因为您仍然可以使用浏览器授予适当设备权限的 localhost:port.
This method allows you to sidestep the whole certificate thing since you can still use localhost:port to which the browser grants appropriate device permissions.
这篇关于localhost 和 192.168.x.x 通过 HTTPS 用于框架 webVR 开发和本地测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!