How to test local server on Mozilla WebXR Viewer on iOS

Sent rootCA.pem and rootCA-key.pem via email to myself to open them from Safari on the iphone, installed the one that allowed me to (rootCA.pem) in profile in Settings > Profile Downloaded and then enabled full trust in it like this https://support.apple.com/en-nz/HT204477 and the local server still has warnings that this connection is not private -_-

by user 103054507105067008

@marcel :cactus: When recently testing on IOS with local server in Mozilla XR Viewer, what workaround did you use to get rid of any ā€˜Your connection is not privateā€™ warnings? Iā€™ve spent a good few hours trying to get that https://www.npmjs.com/package/vite-plugin-mkcert to work and Iā€™m hitting brick walls.

by user 103054507105067008

I havent tried that plugin on mozilla XR yet. But it only shows up on local connections right? So you can just accept the connection?

This is what is happening on iOS when I open the local server link via QR code in Mozilla XR Viewer while trying the open/close/shutdown steps that @herbstšŸŒµ said were a workaround. It simply never loads or shows anything. Same process done on Android with Chrome is totally fine so we just canā€™t test AR from Local Server on iOS at the moment. https://drive.google.com/file/d/1_qiaBXIXZcSWUzyxglGJfBQdqNAL-R2D/view?usp=share_link

by user 103054507105067008

I have also left the phone trying to load that grey or white screen for a full 15+mins to see if it shows anything and it never does

by user 103054507105067008

MKcert was definitely running in these builds too as in vite.config.js I added

    plugins: [
        //viteCompression({ deleteOriginFile: true }),,
        mkcert({force: true}),

and the force true command showed in the local server terminal window that mkcert had launched and made a new cert.

by user 103054507105067008

You can try disabling SSL - it seems like its broken with vite 3 :thinking:

in vite.config.js set ā€œhttps: falseā€ and comment out basicSsl(),, i also changed 'http://localhost:3000': 'http://localhost:3000'

then you can open the server via http:// your ip

youā€™ll get errors in Unity tho since it expects https

Like when mkcert is running, the certificate is still not there/connection not secure on launch

by user 103054507105067008

This was the fix! Thankyou so much! I wasted so many hours looking into this! I can now test AR on IOS to look into some issues I have been told about. Might be worth taking that SSL out of templates for now if it is borked?

by user 103054507105067008

Oh what, WebXR works on Mozillaā€™s viewer without SSL?

Thatā€™s ā€¦ totally against the spec (WebXR always requires https, even on localhost) but lucky for us :upside_down_face:

We canā€™t and wonā€™t take it out of the templates. Itā€™s required for WebXR on any other device/browser and also recommended for any modern development. WebXR Viewer will have to stay the exception there; we can probably make it easier / more apparent what to do to switch SSL off if needed

Iā€™ll test on my android device without SSL in a moment. In the case it all works without SSL, Iā€™ll leave it out for now. If it doesnā€™t work, is there a way to only use SSL if itā€™s on iOS for Mozilla WebXR? Itā€™s been a real pain being unable to test on iOS with local server until this was uncovered that SSL was the root cause

by user 103054507105067008

Iā€™m not sure if vite allows starting both a HTTP and HTTPS server at the same time for the same content, havenā€™t tried that

Since I removed mkcert from vite.config.js and rolled back to commits on git before I added mkecrt, I get this error always in the console before Play runs so Iā€™m looking into that now Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_USER_ERROR1

by user 103054507105067008

its what i meant here

Unity expects the server to run https and pings that ip address