Select a networking option for local development
When developing apps with shopify app dev
, you have multiple options for connecting your local development server to Shopify:
- Cloudflare Quick Tunnels (default)
- Localhost-based development
- Bring your own tunnel (such as ngrok)
Choose the option that best fits your development needs and environment.
Anchor to Cloudflare Quick TunnelsCloudflare Quick Tunnels
By default, Shopify uses Cloudflare Quick Tunnels to open a publicly accessible tunnel to your app. Tunneling provides a secure (HTTPS) URL to your local environment.
If you're experiencing connectivity errors with Cloudflare Quick Tunnels, refer to Cloudflare guidance on firewall requirements, or try one of the alternatives in this guide.
Anchor to Localhost-based developmentLocalhost-based development
When using Shopify CLI version 3.80
or higher, passing the --use-localhost
argument serves your app using localhost
(127.0.0.1
) with a self-signed HTTPS certificate. Shopify CLI creates this certificate for you using mkcert
.
To serve your app using localhost
, run the following command:
Terminal
Shopify CLI runs a reverse proxy server on port 3458
which forwards to your app. You can override this port by passing the --localhost-port
.
Localhost-based development isn't compatible with the Shopify features that directly invoke your app, such as Webhooks, App proxy, and Flow actions, and features that require you to test your app from another device, such as POS.
Anchor to Localhost-based development with Windows Subsystem for Linux (WSL)Localhost-based development with Windows Subsystem for Linux (WSL)
When you run the shopify app dev
command on WSL, mkcert
installs the HTTPS root certificate in the Linux environment, but not in Windows. This results in certificate errors when you attempt to preview your app in a Windows-based browser.
To install the certificate in Windows, do the following. This is only needed the first time you run an app with --use-localhost
.
- In a WSL terminal, navigate to your app's directory.
- Run the following command:
Terminal
Anchor to Manual certificate installationManual certificate installation
If you've disabled Windows interop or Windows PATH
in WSL, then you can manually install the certificate with the following steps:
- In an Explorer window, navigate to
\\wsl.localhost\<distribution>\usr\local\share\ca-certificates
.- For example,
\\wsl.localhost\Ubuntu\usr\local\share\ca-certificates
- For example,
- Double click on the
mkcert_development_CA
certificate file found at this path. - Click Open
- Select Local Machine and click Next.
- Select Place all certificates in the following store.
- Click Browse.
- Select Trusted Root Certification Authorities.
- Click Next and Finish.
Anchor to Bring your own tunnelBring your own tunnel
The --tunnel-url
argument allows you to specify the URL of an alternate network tunnel to your app. You can use this argument with ngrok with the following steps:
- Set up an ngrok account.
- Install the ngrok CLI.
- Follow the steps in the ngrok documentation to set up your access token.
- In a terminal, start ngrok using the following command. You can alternatively choose another port number.
Terminal
- Note the URL ending in
ngrok-free.app
that's returned - you'll need this URL in the following command - and leave ngrok running. - Run
app dev
using the--tunnel-url
argument. If you've chosen another port number, then use that instead.