Answers: <p>If the different CDNs are hosted at different IP addresses one possibility might be to configure the local <code>hosts</code> table for the machines in a certain environment in such way as to overwrite the DNS resolution for the CDNs which shouldn't be accessible and pointing them to either:</p>
  
  <ul>
  <li>a non-existent address, causing connection timeout failures if the invalid CDNs are referenced</li>
  <li>a server where the respective files cannot be found, causing 404 errors (faster than the connection timeouts)</li>
  </ul>
  
Answers: CC BY-SA 3.0
Answers: 2018-03-08T08:44:21.233Z
Answers: clever, I like this.
Answers: avi
Answers: CC BY-SA 3.0
Answers: 2018-03-07T11:53:03.607Z
Answers: 2018-03-07T11:53:03.607Z
Answers: Dan Cornilescu
Body: <p>We have had problems a couple times now where the links to the CDN in our components don't get properly updated between the team, QA, and staging environments.</p>
  
  <p>Is there a way to force an error if the QA environment tries to access the team CDN or vice-versa? Or some other well-known solution to this problem?</p>
  
Tags: <environments><cdn>
Title: What's the best way to restrict an environment to a specific CDN?
UserDisplayName: avi
ThreadText: # What's the best way to restrict an environment to a specific CDN?
  
  (Asked by: username_0 on 2018-03-07)
  
  We have had problems a couple times now where the links to the CDN in our components don't get properly updated between the team, QA, and staging environments.
  
  Is there a way to force an error if the QA environment tries to access the team CDN or vice-versa? Or some other well-known solution to this problem?
  
  **Tags:** environments, cdn
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-07. Score: 2 | Accepted answer
  
  If the different CDNs are hosted at different IP addresses one possibility might be to configure the local `hosts` table for the machines in a certain environment in such way as to overwrite the DNS resolution for the CDNs which shouldn't be accessible and pointing them to either:
  
  * a non-existent address, causing connection timeout failures if the invalid CDNs are referenced
  * a server where the respective files cannot be found, causing 404 errors (faster than the connection timeouts)
  
  > **Comments:**
  > **username_0**: clever, I like this.  
  
  ---
  
  