Aside from Swell's built-in SSL and custom domain management, Cloudflare can be utilized as a third-party solution to accomplish a similar configuration. A Cloudflare account is needed for this, so if you do not already have an account, you can create one through Cloudflare's signup.
The first step will be connecting your domain to your Swell store through the Swell dashboard. Navigate to the Storefront tab under Domains, and connect your domain with your storefront.
If you receive a pop-up window prompting you to verify your domain, close out of the window—this will be handled through Cloudflare.
Now that your domain has been added to Swell, we need to add your site to Cloudflare. From the dashboard, add your site and input the domain name. You will then be prompted to choose a plan. Pick which plan best suits your needs. We like the free plan because, well, it's free.
Once your domain has been linked to Cloudflare, it will generate your custom domain's DNS records for review. We will be making a few changes here.
We want to remove the current CNAME record with the name www as well as any Type A records. Don't worry; we'll be adding these back and directing them to your Swell store.
Let's create your new records to direct traffic and link your Swell store to the custom domain. First, we'll create two new CNAME records.
The first record should have the following:
- Use @ for the Name field
- For the Target, enter your current Swell store domain. It will follow the convention of *.apps.swellstores.com. Simply append your Store ID (found under Developer > API Keys) to the .apps.swellstores.com. For example, if your Store ID was the-feed-bag, your target would be the-feed-bag.apps.swellstores.com.
- Be sure Proxy status is enabled, and save the new record.
For the second CNAME record, follow the steps outlined above—only this time enter www in the Name field rather than @. Once you have created the two new CNAME records, go ahead and continue to the next step in the process.
This step will be done through your domain provider settings. You will need to add the populated Cloudflare nameservers to your domain. For additional assistance on adding custom nameservers to your domain, please refer to your domain provider documentation. Once they have been added to your domain settings, continue to the next step on Cloudflare.
Depending on the domain provider, custom nameservers can take up to 48 hours to take effect.
The last step for Cloudflare will be configuring domain settings for your store domain. Before completing the process, ensure the inputs for each setting matching the following:
- Automatic HTTPS Rewrites: ON
- Always use HTTPS: ON
- Auto Minify: None
Swell already provides this on each store, so there is no need to enable this feature in Cloudflare.
- Brotli: ON
Nice! Mission accomplished. You will be redirected to the Cloudflare dashboard after saving the domain settings. The nameserver change might not have been processed yet, and you can check the status from Cloudflare to confirm. Once everything has synced, your custom domain will properly direct to your Swell store—SSL and all.