> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Reverse Proxy Configuration

> Recommendations, common pitfalls, and troubleshooting tips for serving a Stencil storefront through a third-party reverse proxy or CDN.

A reverse proxy is a server that sits between shoppers and your BigCommerce store. It accepts each request first and forwards it to BigCommerce. Merchants commonly add a third-party reverse proxy or content delivery network (CDN) in front of a Stencil storefront for features such as a custom web application firewall (WAF), traffic logging, access management, or URL rewriting.

This page covers recommendations, common pitfalls, and troubleshooting tips for running a Stencil storefront behind a reverse proxy. It does not cover how to configure a specific proxy service, because setup steps vary by provider. For provider-specific instructions, see your proxy provider's documentation.

For background on reverse proxies, the providers BigCommerce supports, and factors to consider before adding one, see the following BigCommerce Help Center articles:

* [What are Reverse Proxies?](https://support.bigcommerce.com/s/article/What-are-Reverse-Proxies?language=en_US)
* [Third-Party Reverse Proxies](https://support.bigcommerce.com/s/article/Third-Party-Reverse-Proxies?language=en_US)

## Recommendations

### Point your proxy at the canonical domain

Your domain's DNS points to your proxy provider, and the proxy forwards each request to BigCommerce. When your provider supports it, configure the origin with a CNAME record that points to your store's canonical domain, for example, `store-{store_hash}.mybigcommerce.com`, so that the proxy passes the shopper's original `Host` header through unchanged.

Some proxy setups can't use a CNAME record and instead require you to specify the `Host` header that the proxy sends with each request to BigCommerce. In that case, set the `Host` header to your store's vanity domain, which is the custom domain assigned to your storefront, for example, `www.example.com`. Don't set it to the canonical `mybigcommerce.com` domain. BigCommerce uses the `Host` value to determine which storefront and settings to serve. If the proxy sends the canonical domain, BigCommerce serves the canonical domain's responses, including its default robots.txt file, which blocks crawlers.

**`Example request from a proxy to BigCommerce`**

```http title="Example request from a proxy to BigCommerce" showLineNumbers={false}
GET /shop-all/ HTTP/1.1
Host: www.example.com
```

### Configure both the root and www domains

A Stencil storefront can serve traffic at both the root domain (`example.com`) and the www subdomain (`www.example.com`) when a root domain is provided. If you proxy your root domain, configure the www version of your domain the same way, and vice versa. Otherwise, shoppers can reach your storefront through two different paths that behave differently.

### Re-check the proxy after every change

The `Host` header your proxy sends can change as a side effect of other changes in your proxy provider, such as renewing or replacing an SSL certificate, editing origin settings, or adding path-based routing rules. BigCommerce can't see your proxy configuration, so a wrong `Host` header can go unnoticed until search engine or crawler traffic drops. After any change to your proxy, run the checks in [Verify the Host header](#verify-the-host-header).

### Use a supported proxy provider

BigCommerce recognizes traffic from a select group of proxy and CDN providers so that shopper IP addresses pass through correctly to payment gateways, fraud tools, and audit logs. For the current list, see [Third-Party Reverse Proxies](https://support.bigcommerce.com/s/article/Third-Party-Reverse-Proxies?language=en_US).

If you use a provider that isn't on the list, all traffic can appear to come from a few unrecognized IP addresses, which can trigger DDoS protection and payment fraud checks. The [trusted proxy configuration](/developer/docs/storefront/headless/overview#trusted-proxy-configuration) for headless storefronts describes how BigCommerce authenticates a custom proxy and receives the shopper's IP address. That guide is written for headless storefronts, so contact BigCommerce support before you apply it to a Stencil storefront.

### Tell support about your proxy

A misconfigured proxy can cause storefront issues that are difficult to trace back to the proxy. When you contact BigCommerce support about a storefront issue, tell the support team that your storefront uses a reverse proxy, and include the name of your proxy provider. BigCommerce support can't troubleshoot or configure your proxy service, so you may also need to work with your provider or an agency partner.

## Avoid caching dynamic pages

If your proxy caches storefront content, never cache the following shopper-specific pages and endpoints, including any query string variations:

* Cart (`/cart.php`)
* Checkout and order confirmation (`/checkout` and all paths under it)
* Account (`/account.php`)
* Sign in and account creation (`/login.php`)
* Wish lists (`/wishlist.php`)
* Storefront AJAX and API requests (`/remote/v1/*` and `/api/storefront/*`)

As a general rule, don't cache any response that sets a cookie or contains shopper-specific content. Caching these pages can show one shopper's cart or account details to another shopper and can break the checkout flow. BigCommerce already optimizes caching for storefront content, so keep custom caching rules to a minimum.

## Common issues

The following issues often indicate that a reverse proxy isn't configured correctly.

| Symptom                                                                                                  | Likely cause                                                                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/robots.txt` doesn't match the robots.txt settings in the control panel, or blocks all crawlers.        | The proxy sends the canonical domain in the `Host` header, so BigCommerce serves the canonical domain's default robots.txt file instead of the one configured for your vanity domain. See [Verify the Host header](#verify-the-host-header). |
| `/robots.txt` or other pages differ between `example.com` and `www.example.com`.                         | The root and www domains are configured differently in the proxy. See [Configure both the root and www domains](#configure-both-the-root-and-www-domains).                                                                                   |
| Links on the storefront point to the canonical `mybigcommerce.com` domain instead of your vanity domain. | The proxy sends the canonical domain, or no domain, in the `Host` header. Set the `Host` header to your vanity domain.                                                                                                                       |
| Changes to products, content, or theme files don't appear on the storefront.                             | The proxy is serving cached pages. See [Check for a third-party cache](#check-for-a-third-party-cache).                                                                                                                                      |
| The cart, checkout, or account pages show stale or incorrect data.                                       | The proxy is caching shopper-specific pages. See [Avoid caching dynamic pages](#avoid-caching-dynamic-pages).                                                                                                                                |

## Troubleshooting

### Verify the Host header

The quickest way to confirm that your proxy sends the right `Host` header is to compare robots.txt files. Request `/robots.txt` through your vanity domain and through your canonical domain:

```bash showLineNumbers={false}
curl https://www.example.com/robots.txt
curl https://store-{store_hash}.mybigcommerce.com/robots.txt
```

The response from your vanity domain should match the robots.txt settings in your control panel. If it matches the canonical domain's response instead, your proxy is sending the canonical domain in the `Host` header. Repeat the check for both the root and www versions of your domain.

### Check for a third-party cache

To find out whether a third-party cache is causing outdated or incorrect output, add a random query string to the URL of the affected page, for example:

```text showLineNumbers={false}
https://www.example.com/shop-all/?test=test
```

If the page loads with updated data when you add the query string, a cache is involved. Purge the cache in your proxy provider's dashboard, or review its caching rules for that page.

### Compare against the canonical domain

To isolate whether an issue comes from the proxy or the storefront itself, load the same page on your store's canonical domain, for example, `https://store-{store_hash}.mybigcommerce.com/shop-all/`. If the page works correctly on the canonical domain but not through your vanity domain, the issue is likely in your proxy configuration. Compare page content and behavior only: the canonical domain always serves its own robots.txt file and may link to the canonical domain, so those differences are expected.

## Resources

* [What are Reverse Proxies?](https://support.bigcommerce.com/s/article/What-are-Reverse-Proxies?language=en_US) (BigCommerce Help Center)
* [Third-Party Reverse Proxies](https://support.bigcommerce.com/s/article/Third-Party-Reverse-Proxies?language=en_US) (BigCommerce Help Center)
* [Trusted proxy configuration](/developer/docs/storefront/headless/overview#trusted-proxy-configuration) (headless storefronts)