Capturing multiple asset hosts

👍

Covered in this doc

How to configure Percy to capture assets from many different hosts

📘

You are viewing docs for the new @percy/cli. Most SDKs have been updated to utilize the new CLI, so check the appropriate SDK doc for instructions for your specific SDK!

By default Percy's SDKs will only capture assets that have a matching hostname to where the snapshot was captured.

For example, if you're taking snapshots on https://example.com, and the page has assets hosted on https://cdn.example.com, the cdn.example assets will not be captured. In order to capture assets from other hostnames, you will need to each add one to the allowed-hostnames config.

allowed-hostnames can be set via a command line flag (-h or --allowed-hostname) when using percy exec:

$ percy exec -h cdn.example.com -- [your test command]

It also can be set in the Global SDK configuration file. Using yml as an example:

version: 2
discovery:
  allowed-hostnames:
    - cdn.example.com