cretueusebiu / valet-windows

Laravel Valet for Windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404 Not Found

mrl22 opened this issue · comments

I have set up valet for windows and configured, and I can visit http://project.test without issues.

Running valet share works perfectly but when visiting the public URL given by ngrok, it gets a "404 Not Found" response from nginx.

I am quite familiar with nginx and devOps, but I am unable to find where the valet nginx conf is stored within windows to check where it is looking for files.

I believe I have solved this issue with two commits.

I found that if you have a folder called "MyProjec"t and visit MyProject.test, your browser converts the host to lowercase (myproject.test), nginx then relays this on to server.php. server.php looks through all of your linked folders, converts each folder to lowercase and checks if it matches "myproject".

The issue lies where you use the "valet share" command. "valet share" sets up an ngrok proxy where anyone can visit autogeneratedstring.ngrok.io, ngrok passes the correctly cased folder "MyProject" to nginx which is then passed on to server.php. Because server.php loops through all linked folders and converting them to lowercase, any project containing uppercase characters never matches resulting in a 404 Not Found error.

My fix converts the project name coming from nginx to lowercase aswell as the folders and because windows in incasesensitive, it still works.