#How to test local server on Mozilla WebXR Viewer on iOS

1 messages · Page 1 of 1 (latest)

near bane
#

When using the local server ip address in Mozilla WebXR Viewer on iOS, the screen is always blank as it can't seem to show the 'secure website' popup that Chrome usually shows when you first access a local build.

I may have asked about this ages ago but I'm not sure how to get around that on iOS to actually see the webpage.. is there any way to get past that warning popup when Mozilla WebXR Viewer on iOS glitches out trying to show it?

magic wadi
#

We've seen this as well, but the workaround was always force-killing the WebXR Viewer browser and starting it again

#

When you open it again it will show the security warning as usual.

near bane
#

That's the trick, I'll make note this time

magic wadi
#

Would be great if you mark this post as answered if that worked for you 🙂

near bane
#

I can't see where to do that on Discord mobile 😅

magic wadi
#

No prob, just did it if you say it's answered, just wasn't sure if it worked for you this way 🙂

modest cave
near bane
#

I'll triple check on monday with another export I had this issue on to just verify but should be okay thanks for the help 🙌

near bane
#

The close/reopen Mozilla WebXR Viewer doesn't seem to fix it on iPhone 6, trying out mkcert plugin that Marcel recommended, it is installed but I can't seem to get rootCA.pem file in the folder printed by mkcert -CAROOT.
I get the error The term 'mkcert' is not recognized as a name of a cmdlet so continuing to figure out why

magic wadi
#

You can also go the regular way on creating a cert with OpenSSL or others, doesn't need to be throught that mkcert package

#

As soon as you have the files it should be as easy as this:

export default defineConfig({
  server: {
    https: {
      key: fs.readFileSync('./.cert/key.pem'),
      cert: fs.readFileSync('./.cert/cert.pem'),
    },
  },

Haven't found a great flow to do that automatically yet but it's planned as you know 🙂

modest cave
#

We found a nice plugin for vite I sent Rob - but it's not part of the default template because it behaves differently on OSX (requires terminal input which we dont support right now from Unity)

near bane
fathom folio
#

wait
webxr on iOS works?

i tried using Mozilla webxr viewer today for threejs example scenes and it said it doesn't support it

last update was ages ago so i assumed it doesn't work anymore

magic wadi
#

We made sure it does work for three - there were a few issues were WebXR viewer deviated from the spec

Should generally work for the sample scenes too; which one didn't work?

fathom folio
#

ar cones

near bane
#

Okay so to use mkcert properly, the instructions on the Vite plugin do not specify that you need to navigate to C:\Users\###USERNAME###\.vite-plugin-mkcert and run mkcert -CAROOT in a terminal there 🙄

#

Which should then give you a path the the certificate for mobile at somewhere like C:\Users\###USERNAME###\AppData\Local\mkcert

#

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 -_-

near bane
#

@modest cave 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.

modest cave
#

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?

near bane
#

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 @magic wadi 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

#

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

#

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.

modest cave
#

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

#

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

near bane
#

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

near bane
magic wadi
#

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 🙃

magic wadi
near bane
#

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

magic wadi
#

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

near bane
#

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

modest cave
#

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

near bane
#

Even though I rolled back to before I did all that which has me weirded out 😅

modest cave
#

Is the server still running on http?

near bane
#

It was complaining that the port was already in use which would be why then - I closed all terminals on windows but might have been a node.js process still running in task manager

#

What can we do about this SSL issue though? 😦

#

I am now assuming that although I took out SSL, I still had mkcert plugin installed that may have been handling some SSL stuff and perhaps the two just don't work together. As when I took out mkcert the server didn't want to load in chrome and when I rolled back to before I added mkcert and removed SSL then I had the same issue