Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AntV's avatar
Level 6

Ngrok & vite dev

I'm noticing an issue: I cannot convince Vite to cooperate with ngrok. If I just run everything Vite runs in http so I get errors like the following in the web console: https://123.ngrok.com was not allowed to run insecure content from http://[::1]:5173/@vite/client.

If I try to run ngrok through http instead with --scheme=http, ngrok always redirects me to https and as such nothing is shown (to be precise the ngrok ERR_NGROK_3200 page is shown, as nothing is bound to https).

If I add <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> in my layouts, I get errors like the following in the web console: Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made. https://[::1]:5173/@vite/client

I feel like I am jumping through many hoops for something that should (and probably is) much more simpler... What am I missing?!

0 likes
2 replies
Sergiu17's avatar
sudo nano /etc/hosts
# add this, or however you want to call it
127.0.0.1  vite-app.test
ngrok http http://vite-app.test
AntV's avatar
Level 6

Setting any port in ngrok parameters except 80 or 8000 (which is my php artisan serve address), I get connection refused. And if I do set 8000 or 80 I get the same results as the ones described above.

Also I may be wrong, but why would I need to add to /etc/hosts the valet .test address, isn't it redirecting already from valet?

Please or to participate in this conversation.