-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support capturing assets from allowed hostnames #320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍍 LGTM
@@ -1,5 +1,4 @@ | |||
import * as cheerio from 'cheerio' | |||
import * as fs from 'fs' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
it, and we start the integration tests by specifying localhost.me as an allowed-hostname | ||
with the -h flag. | ||
</p> | ||
<img src="http://localtest.me:8000/vue.svg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious how this works in CI? Are we editing a host file to make this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Robdel12 no, localtest.me
's dns entry points to 127.0.0.1. So in CI the node server we spin up that listens to 127.0.0.01:8000 works just the same way it does locally, with no configuration needed.
# [0.10.0](v0.9.2...v0.10.0) (2019-08-07) ### Features * Support capturing assets from allowed hostnames ([#320](#320)) ([c3fb8ac](c3fb8ac))
Adds support for allowed hostnames that assets should be captured from.
If a hostname is specified, any requests to assets on that hostname will be captured, and they'll be uploaded to Percy's API as snapshot resources. During rendering time, http requests to the captured asset's url will be hijacked, and the captured resource served.
Hostnames can be provided either with the
-allowed-hostname
or-h
flag, or they can be specified in the.percy.yml
file as an array under agent -> asset-discovery -> allowed-hostnames.The main function is tested with the new alternate-hostname integration test. It loads a vue.svg file from a hostname of localhost.me. Localhost.me resolves to 127.0.0.1, so we can serve it from our local dev/CI environment, and be sure that the captured asset is being served in production.
Note: requests to https assets won't be successfully highjacked in our rendering environment yet, but this PR should include the appropriate support for capturing them to our @percy/agent based SDKs.