Reverse Proxy Configuration
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:
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.
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.
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.
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 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 (
/checkoutand 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.
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:
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:
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? (BigCommerce Help Center)
- Third-Party Reverse Proxies (BigCommerce Help Center)
- Trusted proxy configuration (headless storefronts)