Testing HTTP Traffic
After adding a new CDN provider to your service, you may want to test it before routing traffic to it. You can do this by bypassing DNS resolution on the test machine using the hosts
file. On Linux or Mac, this file can be found under /etc/hosts
. This enables you to test the new CDN provider on a local machine, without impacting real users.
To test your new CDN provider:
- Navigate to your service.
- In the sidebar, select CDN Providers.
- Copy the CNAME of the newly added provider and use the
dig
command to resolve it.- For example:
dig d3ryv6809vaohj.cloudfront.net
- Copy the returned IP address.
- For example:
- Edit the
/etc/hosts
file on your local machine (might require admin privileges). Add a new line at the end of the file, combining the IP address from the previous step with your service domain.- For example:
18.160.143.49 www.example.com
- Save the file and exit.
- For example:
Once this is done, any request to your service domain will be directed to the new CDN provider. You should now be able to test it before routing traffic.
Verifying the Response
You can verify that your request is being served by the new provider by checking the x-ioriver
response header.
For example, the following curl
command shows that the request was served by Fastly:
curl -v https://www.example.com
...
< x-ioriver: Fastly