Local development
Run your Pages application locally with our Wrangler Command Line Interface (CLI).
Install Wrangler
To get started with Wrangler, refer to the Install/Update Wrangler.
Run your Pages project locally
The main command for local development on Pages is wrangler pages dev
. This will let you run your Pages application locally, which includes serving static assets and running your Functions.
With your folder of static assets set up, run the following command to start local development:
$ npx wrangler pages dev <DIRECTORY-OF-ASSETS>
This will then start serving your Pages project. You can press b
to open the browser on your local site, (available, by default, on http://localhost:8788).
HTTPS support
To serve your local development server over HTTPS with a self-signed certificate, you can set local_protocol
via wrangler.toml
or you can pass the --local-protocol=https
argument to wrangler pages dev
:
$ npx wrangler pages dev --local-protocol=https <DIRECTORY-OF-ASSETS>
Attach bindings to local development
To attach a binding to local development, refer to Bindings and find the Cloudflare Developer Platform resource you would like to work with.
Additional configuration via wrangler.toml
If you are using a wrangler.toml
configuration file in your project, you can set up dev server values like: port
, local protocol
, ip
, and port
. For more information, read about configuring local development settings.