ruttydm's avatar

Valet share + ngrok + vite not working

So I can't seem to solve one particular problem. I have been trying to solve it for a couple hours now but to no avail.

To reproduce: -I make a new laravel project and add the breeze starterkit

  • I install all packages and run "npm run dev"
  • I run "valet secure"
  • I run 'valet share" which gives me the ngrok link

But when I go to the standard /login page none of the css/js is loading. The same problem happens when I access it on my local network.

The console outputs this:

[Warning] [blocked] The page at https://3a22-195-62-90-241.ngrok.io/login was not allowed to run insecure content from http://[::1]:5173/@vite/client.

[Warning] [blocked] The page at https://3a22-195-62-90-241.ngrok.io/login was not allowed to run insecure content from http://[::1]:5173/resources/css/app.css. (login, line 15)

[Warning] [blocked] The page at https://3a22-195-62-90-241.ngrok.io/login was not allowed to run insecure content from http://[::1]:5173/resources/js/app.js.

[Warning] The page at https://3a22-195-62-90-241.ngrok.io/login contains a form which targets an insecure URL http://3a22-195-62-90-241.ngrok.io/login. (login, line 28)

0 likes
7 replies
ruttydm's avatar

I dirty workaround I currently use is just linking to the build files before the vite directive. This way I can see the site from my mobile after running vite build.

cmsedore's avatar

Try adding this to boot method in AppServiceProvider.php:

\URL::forceScheme('https');

found this buried in a valet GitHub chain...

1 like
ryanmortier's avatar

Running into this issue today. URL::forceScheme('https') works but seems like a workaround for something that should work in the first place.

arlonfelipe23's avatar

I was having this issue and what I did to fix:

I changed the APP_URL in .env to the ngrok https address Run "HTTPS=true yarn dev" instead of just "yarn dev"

Please or to participate in this conversation.