News for hackers. Stuff that matters.
Re:Amazon DNS error by cjreyes on Wednesday November 26, 2014 @07:57PM (#8665471)
Is there a RoR Gem / configuration that will serve assets locally if an external asset host name doesn't resolve or times out?
Re:Amazon DNS error by Hengjie on Wednesday November 26, 2014 @08:26PM (#8665558)
There isn't, but there's a frontend library that you can use to add fallbacks to <script> tags:

https://github.com/shinnn/script-fallback-from-urls

Re:Amazon DNS error by tbfrench on Wednesday November 26, 2014 @08:28PM (#8665564)
Not a gem, but from jQuery days:

<script> window.jQuery || document.write("<script src='js/jquery-1.10.2.min.js'>\x3C/script>")</script>

Re:Amazon DNS error by jacobsenscott on Wednesday November 26, 2014 @10:16PM (#8665830)
You can assign a proc to config.asset_host, so you could easily do it -

  config.asset_host = -> {
    cdn_up? ? "http://mycdn.com" : "http://mydomain.com"
  }
Re:Amazon DNS error by lukeschlather on Wednesday November 26, 2014 @08:50PM (#8665621)
It's a decent idea, but it would be better to do client-side. For this sort of event, knowing that the name resolves on the server doesn't give you any confidence it will resolve for the client.

What would be really nice is if you could specify a fallback host in your DNS prefetch, and the browser would make it "just work."

Re:Amazon DNS error by thejosh on Wednesday November 26, 2014 @08:56PM (#8665637)
Exactly, if a POP for Australia is down but works in Germany, better to serve this on the client side.
Re:Amazon DNS error by bbnnt on Wednesday November 26, 2014 @08:04PM (#8665494)
that'd be genius