How to host a Shopify export on Cloudflare Pages
To host a Shopify storefront export on Cloudflare Pages, unzip the WebExport download and run npx wrangler pages deploy ./exported-site --project-name my-site. The copy has no cart or checkout. Use _redirects to send cart paths to your Shopify store, and re-export whenever prices change.
Last reviewed
Key facts
- Static files on Pages cannot run a cart, a checkout or customer accounts.
- A _redirects line to an absolute URL works for sending visitors to Shopify.
- Redirects do not apply to requests that a Pages Function handles.
- Shopify’s product CSV excludes images and collection membership.
What a Shopify export brings to Cloudflare Pages
A WebExport copy of a Shopify store contains storefront HTML, CSS, JavaScript, product layouts, collection pages, fonts and images. Cloudflare Pages serves that as a fast static front end. It does not run orders, so decide where the buy path goes before you point the domain.
Product catalogs are image heavy, so mind the file limits. Pages allows 25 MiB per file and a fixed file count per deployment on the free plan, which a store with thousands of product images can approach. Run the export, count the files in the folder and compare them with Cloudflare’s current limits page.
Deploy with Wrangler direct upload
- Unzip the download into a folder that holds index.html at the top.
- Create a Pages project once, then deploy the folder to it.
- Open the pages.dev address the command prints and test a few URLs.
- Attach your domain from the project’s custom domains tab.
npx wrangler pages project create my-site
npx wrangler pages deploy ./exported-site --project-name my-siteRedirects, headers and 404s on Cloudflare Pages
Cloudflare Pages reads _redirects and _headers from the output directory. A redirect line is the source, the destination and an optional status code, and the default is 302, so write 301 for permanent moves. The limits are 2,000 static and 100 dynamic redirects, with each declaration capped at 1,000 characters, and 100 rules in _headers. If the folder has no 404.html, Pages answers unknown paths with the root index.html, so add a 404.html to get real 404 responses.
This _redirects file sends server-only paths back to the Shopify store. Each rule uses an absolute destination and a 302.
/cart https://your-store.myshopify.com/cart 302
/checkout https://your-store.myshopify.com/checkout 302
/account https://your-store.myshopify.com/account 302
/collections/all /collections 301Swap your-store for your own handle. The last line is an example of tidying a duplicate listing page. Redirects run before headers, and a Function-generated response skips both, so do not mix a Function into the cart path.
Shopify output that needs fixing on Cloudflare Pages
| In the Shopify output | What to do on any static host |
|---|---|
| /cart and /checkout paths | These are server pages. The static copy has no cart, so link buyers to your Shopify checkout or a buy button. |
| Calls to /cart.js and product .js endpoints | These live Shopify endpoints return 404 on a static host. Remove or replace the scripts that call them. |
| Prices and stock frozen at export time | Product pages show the values from the day of the export. Re-export after price changes. |
| Images from cdn.shopify.com | Rewritten to local paths. Check large collection pages, because product images add up quickly. |
Find theme code that calls /cart.js, /cart/add.js or a product .js endpoint. Those exist only on Shopify and return 404 on Pages, which breaks add to cart. Replace the button with a link to the product on your store, and replace theme contact forms with a hosted endpoint or a Pages Function. Re-export after price changes, because product pages are frozen at export time.
Forms and dynamic features
Static files cannot receive a POST. Either use a form service, or add a Pages Function under a functions folder that handles the request. Redirects and the _headers file do not apply to responses a Function generates.
A Pages Function can receive a contact form POST and forward it. Keep customer accounts and order tracking on Shopify through the /account redirect.
What can go wrong
- Running a Function on a cart path skips the redirect rule, so the visitor never reaches Shopify.
- Stale prices on saved pages can confuse buyers. Re-export after each price change.
- A store with many product images can hit the per deployment file limit.
Frequently asked questions
Can I take orders on a Pages site made from Shopify?
Not from the static files. Send the buy path to your Shopify store or another checkout service and let Pages serve the browsing pages.
What file limits apply to a store on Pages?
Cloudflare lists 25 MiB per file and a cap on files per deployment. Check the limits page before deploying a large catalog.
Do my Shopify product URLs stay the same?
Product and collection paths are saved with their original addresses, so existing links and search results keep working as long as you keep the same domain.
Can Cloudflare proxy my Shopify checkout?
Redirecting to the Shopify checkout is the simple route. Proxying a checkout is a separate topic with its own risks, so use a plain redirect unless you have a clear reason.
Official documentation
Free tools for this job
- No-Code Platform DetectorInstantly detect if a site is built with Webflow, Framer, Squarespace, Wix, or Shopify.
- Website Asset Size AnalyzerAnalyze all images, JS, and CSS weights to find performance bottlenecks.
- Static Hosting PickerAnswer 5 questions and get the best hosting recommendation for your exported site.
- Static Site Hosting Cost CalculatorCompare hosting costs: Webflow vs Vercel vs Netlify vs Cloudflare Pages at scale.
Get the Shopify files first
Paste your public Shopify URL into the export form and download a ZIP you can deploy to Cloudflare Pages. The Free plan covers 1 site, 5 exports a month, 15 pages and 20 MB per export. Professional is a $9.99 one-time purchase with unlimited pages.