title: AWS Route53 failover and chrome DNS cache
body: <p>I have pretty standard failover with Route53:</p>
  
  <ul>
  <li>Two regions</li>
  <li>Primary, associated with a health check, and Secondary failover records for each region.</li>
  <li>records point to the APIs. Also, we have front-end JS application which is using the API.</li>
  </ul>
  
  <p>If Primary is unhealthy, then DNS returns a Secondary record, which is working perfectly, if user not using the application at the moment of failure.</p>
  
  <p>So:</p>
  
  <ul>
  <li><p>if Primary is unhealthy and user tries to use the app <strong>after failover</strong> has been activated - everything is ok (points to Secondary record)</p></li>
  <li><p>if Primary becomes unhealthy when <strong>user is using</strong> the application, the application tries to access an old IP address, which is unavailable, so it is not switching to a secondary record.</p></li>
  </ul>
  
  <p>Seems DNS is cached (can be checked here chrome://net-internals/#dns for Chrome). A user can continue to use the app after some time of an inactivity: when API was not triggered and Chrome's DNS cache is expired.</p>
  
  <p>Is there any workaround for this particular case when Primary became unhealthy while a user is using the application? Or how can we make a user experience more pleasant in this case?</p>
  
  <p>Added example:</p>
  
  <ul>
  <li>User 1 is using the app (app is Ember.js app)</li>
  <li>Primary is down and failover is activated</li>
  <li>After that User 2 access the app (failover is active) and route53 provides a Secondary record, so everything is ok.</li>
  <li>Meanwhile, User 1 is still trying to access the app, app making requests to API. But an app is accessing old IP from chrome DNS cache.</li>
  </ul>
  
  <p>Added:</p>
  
  <p>We are using <strong>Alias records</strong> (TTL of A records on Route53 are always 60 sec)</p>