title: ember dynamic adapter host update
body: <p>I have an adapter something like this:</p>
  
  <pre><code>var Adapter = DS.RESTAdapter.extend({
      host: 'http://localhost:4200'
  });
  
  if (config.environment === 'production') {
      Adapter.reopen({
         host: 'http://foo.example.com'
      });
  }
  </code></pre>
  
  <p>This has been working for a while, but recently something breaks. My ember app interfaces with a number of different subdomains (eg <code>foo.example.com</code> and <code>bar.example.com</code>). My understanding is that <code>reopen</code> changes all instances, which is what I think happens. When I browse to '/bar' it uses the correct adapter in production, but browsing to '/foo' still uses the <code>bar.example.com</code> endpoint.</p>
  
  <p>My question is two fold. Firstly, am I using the right approach here?</p>
  
  <p>Secondly, I'd like to change the adapter based on a runtime setting. I need to work around IE8 lack of CORS support so am thinking that if I have an ie8 switch, the adapter should hit <code>example.com/foo</code> instead of <code>foo.example.com</code>. In my mind these two areas are conceptually related, but I'm happy to be wrong.</p>
  
  <p><strong>update</strong></p>
  
  <p>To simplify things, I essentially want to find the hostname of the request and pass that into the adapter. For example if I browse to <code>www.example.com</code> I want the adapter to go fetch a record from <code>www.example.com/foo</code>, or when browsing to <code>www.example2.com</code> I want the adapter to fetch the record from <code>www.example2.com/foo</code>. I hope that makes sense. Is this even possible?</p>