Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

youngjedi's avatar

Valet / Ngrok Custom Domains for Callbacks and Webhooks

Hello there!

I'm setting up a new MacBook, and Valet is stating that it doesn't play well with custom domains anymore. This is a bummer, as many of the applications I have developed have Google authentication or third-party webhooks which often do not support .test domains.

My experience with Ngrok historically was that whenever you run it, the URL changes. It's a huge pain for webhooks, callback URLs, etc., as I can't just open up my IDE and hit the ground running.

So my question is this: will a paid version of Ngrok allow me to have a custom domain (call it customdomain.com) that I can then use across all my local applications?

app1.customdomain.com app2.customdomain.com app3.customdomain.com

Then, whenever I run the app -- it will use the set (static) URL, and I won't have to mess around with the callback and webhooks.

Any help/guidance would be appreciated!

0 likes
2 replies
LaryAI's avatar
Level 58

To achieve a setup where you can use custom subdomains with Ngrok for your local applications, you can indeed use the paid version of Ngrok, which offers the ability to reserve custom subdomains. Here's how you can set it up:

  1. Upgrade to a Paid Ngrok Plan: First, you'll need to subscribe to a paid Ngrok plan that supports custom subdomains. This will allow you to reserve a subdomain that remains consistent across sessions.

  2. Reserve a Custom Subdomain: Once you have a paid plan, you can reserve a custom subdomain. This can be done through the Ngrok dashboard. For example, you might reserve app1-customdomain for your first application.

  3. Configure Ngrok with Reserved Subdomains: You can configure Ngrok to use these reserved subdomains by specifying them in your Ngrok configuration file or directly in the command line when starting Ngrok.

    Here's an example of how you might configure Ngrok using the command line:

    ngrok http -subdomain=app1-customdomain 80
    

    This command will start Ngrok and map the reserved subdomain app1-customdomain.ngrok.io to your local server running on port 80.

  4. Set Up Multiple Applications: If you have multiple applications, you can reserve additional subdomains for each one. For example, app2-customdomain and app3-customdomain. You would start Ngrok for each application with its respective reserved subdomain.

  5. Update Your Application Configurations: Once you have your static Ngrok URLs, update your application configurations to use these URLs for callback URLs, webhooks, etc. This way, you won't need to change these settings every time you start Ngrok.

  6. Automate the Process: To streamline the process, you can create scripts or use a task runner to start Ngrok with the correct subdomain for each application automatically.

By following these steps, you can have a consistent and reliable setup for handling callbacks and webhooks with custom domains using Ngrok. This will save you the hassle of updating URLs every time you start your development environment.

1 like
martinbean's avatar

My experience with Ngrok historically was that whenever you run it, the URL changes.

@youngjedi That’s not the case any more. With the free version of ngrok, you get one domain that does not change between invocations.

If you go to your ngrok dashboard, and then “Domains” under “Universal Gateway”.

I can’t remember if ngrok generates it for you, or if you have to generate it, but you then get a domain ending in ngrok-free.app that you can use for webhooks, etc.

1 like

Please or to participate in this conversation.