Documentation
Feedback
Guides
Storefront Development

Storefront Development
2. Configuring external DNS
In this guide, you will learn how to configure external domains for your FastStore and VTEX website. The process involves the following steps:
  • Setting up your external DNS provider to point your custom domain to your VTEX website. Custom domains can be purchased from any domain registration platform.
  • Configuring your custom domains in VTEX Account Settings.
  • Associating your custom domains with your FastStore project.
Besides making your FastStore website accessible via a custom domain, VTEX Checkout will also be operational as soon as you complete this guide. You'll then be ready to continue configuring other VTEX solutions, such as Order Placed, Login, and My Account.

Before you begin


Step by step

If you still need to configure other VTEX solutions, please use a fictitious domain name while taking the following steps. Once you have set up all the desired integrations, repeat this guide using your final domain to make your website publicly available to end-users.

Step 1 - Creating DNS records

  1. Access your domain provider's website.
  2. Create a CNAME DNS record for your www domain (e.g., www.mystore.com) that points to www.{rootDomain}.com.cdn.vtex.com (e.g., www.mystore.com.cdn.vtex.com). Check the documentation of your domain provider for more information.
  3. Now, create a CNAME record for the secure subdomain (e.g., secure.mystore.com) that points to secure.{rootDomain}.cdn.vtex.com (e.g., secure.mystore.com.cdn.vtex.com). This subdomain will be used by the Checkout, Order Placed, Login, and My Account pages.
Please note that the configured addresses may not be immediately available to everyone due to DNS propagation, which can take 24-48 hours to complete.

Step 2 - Putting your account into production

To proceed, make sure your store is active and in production, to do this, follow the steps in the article Putting your account into production.### Step 3 - Configuring domains in VTEX Account Settings
Now, you must set up your VTEX account to use the DNS records created in the previous step.
  1. On VTEX Admin, click your profile avatar, which can be identified by the first letter of your email address.
  2. Access Account Settings > Account.
  3. Go to the Stores tab and in the Hosts table, click the menu () and choose Edit.
  4. In the Hosts field, enter your main domain (e.g., mystore.com) to the list.
  5. Click Add.
  6. Add the secure subdomain (e.g., secure.mystore.com) to the list.
    {"base64":"  ","img":{"width":387,"height":101,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":8596,"url":"https://vtexhelp.vtexassets.com/assets/docs/src/hostsConfig___cad00ec89023cd77c34f77898cda1b3e.png"}}
  7. Click the Save button.

Step 4 - Associating your custom domain with your FastStore project

Back to your FastStore project, you must also configure your project to point to the right addresses and domains.
  1. Open your FastStore project in any code editor of your preference.
  2. Open the faststore.config.js file.
  3. Update the storeUrl, secureSubdomain, checkoutUrl, loginUrl, and accountUrl properties as in the following:
    • storeUrl: https://{rootDomain}
    • secureSubdomain: https://{subdomain}.{rootDomain}
    • checkoutUrl: https://{subdomain}.{rootDomain}/checkout
    • loginUrl: https://{subdomain}.{rootDomain}/api/io/login
    • accountUrl: https://{subdomain}.{rootDomain}/api/io/account
Take the following example of how this code block would look after configuring a store with the www.mystore.com domain and secure subdomain:
copy

_15
...
_15
_15
// Default channel
_15
channel: '1',
_15
_15
+ // Production URLs
_15
+ storeUrl: 'https://www.mystore.com',
_15
+ secureSubdomain: 'https://secure.mystore.com',
_15
+ checkoutUrl: 'https://secure.mystore.com/checkout',
_15
+ loginUrl: 'https://secure.mystore.com/api/io/login',
_15
+ accountUrl: 'https://secure.mystore.com/api/io/account',
_15
_15
// Lighthouse CI
_15
lighthouse: {
_15
...

  1. Save your changes.
  2. Open the vtex.env file.
  3. Add the SITE_HOST key with the main domain specified in Configuring domains in VTEX Account Settings as the value.
copy

_10
+ SITE_HOST=www.mystore.com

  1. Save your changes.
  2. Open a Pull Request, commit your changes, and deploy them to main/master.

Step 5 - Configuring the CDN workflow (Only for new go-lives)

If your FastStore website is going live for the first time, open a ticket with VTEX Support and specify that you need to configure the CDN workflow for the secure and main domains of your store.
Remember to include the following information in your ticket:
  • Your VTEX account name.
  • The secure and main domains of your store.
The VTEX team will evaluate your request and take the necessary actions to configure the CDN workflow for your account.

Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
+ 3 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
+ 3 contributors
On this page