MacOS - How to use Laravel Herd and ngrok for a multi-tenant app to receive webhook
Hi all. I am working on a multi-tenant application that uses the subdomain to identify the tenant e.g. demo.happykids.test.
I read through Laravel Herd docs on sharing a site and this is what I've tried so far with no success:
- Expose shows an error when starting it saying that I need to be on a paid plan to use a subdomain.
- ngrok also does not work. Here's the command I'm using
ngrok http --host-header=rewrite demo.happykids.test:80
The funny thing is that ngrok works fine on Windows with Laravel Herd. I read that the Windows version of Herd does not use dnsmasq, so it uses the host file. This issue is the only thing holding me back from fully moving to macOS.
Does anyone know how to get this working?
Hey!
I could suggest the following:
-
Try this instead:
ngrok http --host-header=demo.happykids.test 127.0.0.1:80
This keeps the correct Host header but points directly to Herd’s internal port.
-
You can also try mapping
demo.happykids.test
to127.0.0.1
in your/etc/hosts
just to ensure everything resolves correctly while testing.
If this does not work, it might be worth opening an issue on the Herd support repo to share your use case: 👉 https://github.com/beyondcode/herd-community/issues
Would be great to have better multi-tenant and webhook support out of the box.
- Bobby
Hi Bobby,
I tried what you suggested but it did not work. Thank you for taking the time to help.
I'll make a post on the Herd support repo soon.