Static site hosting

This guide will show you how to host a static site using the File Store DXP Service.

Prerequisites

Squiz Support must complete these prerequisite configuration tasks on your behalf before you can begin to use the static site hosting feature.

Open a support request with Squiz Support and direct them to this page when requesting that static site hosting is enabled for your DXP Organization.

Feature Flags

Check that the following feature flags are enabled for the customer’s DXP instance:

  • Digital Asset Management

  • Static Site Hosting

  • File Store

Content Management domains setup

Ensure that the customer has the domain setup in Squiz Content Management that they want to use to host the static site. If they want the domain’s www and non-www versions to work, they must set up both domains in Content Management.

Enable static hosting on domains

Static hosting must be enabled for the domains on which the customer wants to host the static site. Check if this configuration is in place by viewing the Service settings and noting whether the Enable static hosting on this domain option is selected.

Image of the static hosting enabled setting

About static site file resolution

The resolution flow for files hosted in the static site is as follows:

  • If the URL matches a folder in the mapped folder, the index.html file is served.

  • If the URL with a / appended matches a folder in the mapped folder which contains an index.html file, that index.html is served.

  • If the URL matches a file in the mapped folder, that file is served.

  • If the URL does not match a file or folder (or the index.html file does not exist), a 404.html file from the root of the mapped folder is served.

  • If the 404.html file does not exist, the request is forwarded to the Squiz Content Management instance to which the domain is linked.

Uploading files to the File Store

To populate the static site content, you must import the static site files to the folder you mapped to the domain or sub-folder.

The recommended way of preparing your static site files is by creating a tar or gzip archive of your entire static site. You can then upload the archive using the UI or the File Store API. Using the Expand option in the File Store UI, you can expand the archive into an empty, mapped folder to deploy your static site.

Before you start

  • Read the Usage guidelines and recommendations for large files to understand the file size requirements and limits for the service.

  • Remember that for File Store to serve a file from a static site, the file must:

    • have public permissions set on it in the File Store.

    • have returned a safe status when scanned by the virus scanner.

Steps

To prepare a static site folder for upload to the File Store:

  1. Create an archive file (using either the tar or gzip format) of the folder you want to upload.

  1. Using the File Store UI or the Large file process endpoint, upload the archive to the root of your File Store folder.

    1. To use the UI, navigate to Digital Asset Management  File Store

    2. Either click the Upload files button or drag your file into the highlighted area of the UI:

      upload files ui
  2. [Optional] Create an empty folder to extract the archive.

  3. Extract the archive file using the Extract option from the more_horiz menu next to it.

    Image of the extract dropdown screen
  4. Select a folder into which to extract the archive’s contents.

    extract modal
  5. Click Confirm to begin the extraction process.

  6. After the files are extracted, verify that all files:

    • Have the virus scanner icon present to indicate they are safe.

    • Have got Public file permissions set.

Mapping a folder to a domain or sub-folder

To begin hosting a static site, you must map a folder from the File Store service to a domain or a sub-folder. Doing so lets you access the static site from that selection.

Before you start

  • As described in Usage guidelines and recommendations, mappings are domain specific. If you want both to work, you must follow these steps on both the domain’s www and non-www versions.

  • The static site will be accessible from the domain or sub-folder and will overwrite any existing content.

Steps

To map a folder to a domain or sub-folder:

  1. In your Squiz DXP organization home page, click the Configuration  Static sites card.

    Image of static site configuration screen
  2. Select the domain for which you wish to add a mapping.

  3. Click the Add route button to add a route to the domain at the top of the list.

    add route button
    Use the Edit action under the more_horiz menu to add a route to other domains in the list.
  4. Enter the Path URL, if required. This field is optional. This is the sub-directory specification for your site domain. For example, www.my-website.com/static-site

    mapping screen
  5. Select the Repository path. The existing File Store directory where your static site or files are located.

    Files in File Store must be public to be served through a static route. At a minimum, a 404.html file is required in the target folder.
  6. Click Add to map the repository path.

  7. After a few minutes, confirm the mappings are available as the process can take a short while to complete.

Be aware that unresolved mappings fall back to the associated Squiz Content Mangement instance. Read the About static site file resolution documentation for more information.

Accessing the Static Site

After the files have been uploaded to the folder, you can access the static site from the domain or sub-folder to which you have mapped the folder.

Troubleshooting

If the static site is not accessible, check the following configuration areas:

  1. Does the domain have static hosting enabled?

    Check the Service settings page.

  2. Are the mappings set up correctly?

    Check the Configuration  Static sites  Mappings page.

  3. Have the files been uploaded to the correct folder?

    Check that the folder contains all the required files using the File Store UI.

  4. Do all files have public permissions set on them?

    Check the file permissions in the File Store UI.

  5. Have all files been scanned by the virus scanner and have returned a safe status?

    Check the virus scanner status icon in the File Store UI.