Skip to content

Valet 404s all requests through ngrok, if the base site directory contains capital letters #1252

@jackwh

Description

@jackwh
  • Valet Version: 3.1.6
  • PHP Version: 8.1.6

Description:

My Laravel app is located in ~/Sites/MySite. I used valet park within the ~/Sites directory to set it up, with a clean installation earlier today.

After running valet share, all requests through the ngrok URLs would simply return a 404 page. It wasn't a 404 page I recognised (i.e. not my app's), but the ngrok web interface showed they were from Valet.

All requests would 404. Here are some examples headers from ngrok's UI:

GET / HTTP/1.1
Host: MySite.test
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en;q=0.9
Upgrade-Insecure-Requests: 1
X-Forwarded-For: 81.169.204.198
X-Forwarded-Proto: http
X-Original-Host: 63cb-82-159-204-198.ngrok.io

The one bit that stood out was Host: MySite.test. Not sure why, just a hunch, but starting afresh from a lower-case directory fixes it.

I've been using Valet with a MySite directory for months with no issues, but today was the first time I tried valet share, so I assume this is specific to how Valet interacts with ngrok.

I'm on macOS Monterey 12.3.1. My drive is formatted as APFS (Encrypted), so no case-sensitivity.

Steps To Reproduce:

  1. Make a directory called ~/Sites/MyWebsiteWithCapitalLetters and load some test code in there.
  2. Run cd ~/Sites && valet park
  3. Run cd ~/Sites/MyWebsiteWithCapitalLetters && valet share
  4. Visit the ngrok URLs, you should see a very sparse 404 page
  5. Stop sharing, run cd ~/Sites && valet forget
  6. Rename the directory to ~/Sites/mywebsitewithcapitalletters
  7. Repeat steps 2 – 4, this time the site should be served correctly

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions