brew install cloudflare/cloudflare/cloudflared
cloudflared tunnel login
cloudflared tunnel create <NAME>
💡 Default tunnel name I've setup in the cf bash script below is local
, so you could set it as local too.
Confirm that the tunnel has been successfully created by running:
cloudflared tunnel list
More details: Set up a tunnel locally.
Add DNS record for your tunnel.
cloudflared tunnel route dns <Tunnel Name> subdomain.yourdomain.com
Example assuming local
is your tunnel name:
cloudflared tunnel route dns local local.yourdomain.com
Download the given cf
script and store it at a location where you can easily access and make it executable:
chmod +x cf
If you've used a different tunnel name other than the default local
, then make sure to update the TUNNEL_NAME
in cf
script.
Go into any of your valet site's directory and fire:
cf
If everything goes well, then your local site should now be exposed to the internet via Cloudflare Tunnel and accessible at local.yourdomain.com
.
Super! Thanks a lot.
I have modified it a little to work with Herd (https://herd.laravel.com/).
I have also added a wildcard CNAME record (
*
) to use it like{project}.yourdomain.com