mgx

my cloudflare tunnel setup for shopify app development

Documenting this for my own reference and figured others might find it useful if they're hitting the same frustration. Shopify's `shopify app dev` uses Cloudflare QuickTunnels, which generate a new URL every time I restart my development server. This broke my workflow constantly -- I had to redeploy, update webhook configurations, and reconfigure third-party services. So I switched to Cloudflare Zero Trust Tunnels for static URLs that never change. The setup is as follows: ### 1. Created a tunnel in Cloudflare Zero Trust - [Created a new tunnel](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/get-started/create-remote-tunnel/) - Updated [cloudflared](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/) on my machine ### 2. Configured public hostname Set up routing for my dev environment: - **Public hostname**: `shopifydev.mydomain.com` - **Service**: `http://localhost:3000` - **Path**: `*` ### 3. Updated shopify.app.toml ```toml # Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration client_id = "client-id" name = "Acme" application_url = "shopifydev.mydomain.com" embedded = true [build] automatically_update_urls_on_dev = true [webhooks] api_version = "2026-01" [[webhooks.subscriptions]] compliance_topics = [ "customers/data_request" ] uri = "/webhooks/customers-data-request" [[webhooks.subscriptions]] compliance_topics = [ "customers/redact" ] uri = "/webhooks/customers-redact" [[webhooks.subscriptions]] compliance_topics = [ "shop/redact" ] uri = "/webhooks/shop-redact" [access_scopes] # Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes scopes = "read_content,write_content,read_products,read_script_tags,write_script_tags,write_files,read_files" [auth] redirect_urls = [ "https://shopifydev.mydomain.com/api/auth", "https://shopifydev.mydomain.com/auth/shopify/callback", "https://shopifydev.mydomain.com/auth/callback" ] ``` ### 5. Deployed and ran ```bash shopify app deploy shopify app dev --tunnel-url="https://shopifydev.mydomain.com:3000" ``` Now I just run dev and it works. No URL changes, no webhook updates, no wasted time. The tunnel runs in the background and routes traffic to my local server automatically. One-time setup, permanent solution.

Tagged in tech, cloudflare