The Netlify CLI is a great development tool for your Netlify site, bringing the full suite of platform primitives right into your computer. When you run netlify dev
, we’ll start a local development server with access to redirects, Forms, Netlify Functions, Netlify Edge Functions, and more.
By default, this server runs on a local address like http://localhost:8888, which means it’s only accessible within your machine. But sometimes you might want to share your work with other people, which would require a publicly accessible URL.
And that’s exactly what happens when you run the command with the --live
flag! We’ll generate a .netlify.live
URL that you can share with anyone to view your site, in real-time, as you develop it.
This is also incredibly useful if you’re developing a function that responds to a webhook from an external service, as you can point it at your live URL and iterate quickly, with a very short feedback loop.
Fixed URLs
Until recently, the live URLs used a random subdomain that changed every time you started the CLI. This made it difficult to use them in automated workflows, and forced you to reconfigure any external services with the updated URL whenever you started over.
That is no longer the case. When you generate a live URL for the first time, the Netlify CLI will remember it and reuse it every time you start a session on your computer.
Custom URLs
If you want something nicer than a random sequence of letters and numbers, you can pass your own custom subdomain to the --live
flag.
For example, running netlify dev --live=jane
will generate a URL like https://jane--YOUR-SITE-NAME.netlify.live
, giving you an identifiable and easy to memorize URL that you can share with anyone.
This feature requires version 15.4.0 or great of the Netlify CLI. To update, run npm install -g netlify-cli
.