Forrest logo
back to the wrangler tool

wrangler:tldr:f3113

wrangler: Start a local development server.
$ wrangler dev --host ${hostname}
try on your machine

The command "wrangler dev --host ${hostname}" is used in the context of the Cloudflare Workers platform.

Here's what each part of the command does:

  • "wrangler dev" - This is a command used with the Wrangler tool, which is a command-line tool provided by Cloudflare. It's used to develop and test Cloudflare Workers, which are serverless functions that run on Cloudflare's global network.

  • "--host" - This is an option flag used with the "wrangler dev" command. It specifies the hostname or domain name that you want to use for local development and testing of your Cloudflare Worker. By default, if you don't specify a value after "--host", it will use "localhost" as the hostname.

  • "${hostname}" - This is a placeholder that represents the specific hostname or domain name you want to use for local development. It should be replaced with an actual hostname or domain name, such as "example.com" or "subdomain.example.com". By specifying the hostname, you can test how your Cloudflare Worker behaves for specific domains before deploying it.

For example, if you have a Cloudflare Worker that modifies the response for requests to "example.com", you can use "wrangler dev --host example.com" to test how the worker behaves locally for that domain.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the wrangler tool