Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple domains for different ressources ? overriden httpconfig #61

Open
AlexandreBonaventure opened this issue Nov 3, 2016 · 2 comments

Comments

@AlexandreBonaventure
Copy link

Hi,
Wondering how to manage multiple httpConfig for different ressource (eg: setting different domain url for different ressource ), I ended up working with two adapters, which I believe was the right way to achieve it.

But I was surprised httpConfig was overridden by registering two http adapters.

Repro: https://jsfiddle.net/alexandreBonaventure/9ue6v6qy/6/

Is there an another to achieve this, any workaround ?

@AlexandreBonaventure AlexandreBonaventure changed the title Multiple domain for different ressources ? overriden httpconfig Multiple domains for different ressources ? overriden httpconfig Nov 3, 2016
@jmdobry
Copy link
Member

jmdobry commented Dec 12, 2016

Instead of using httpConfig#baseURL, I would recommend the following:

store.registerAdapter('http2', new DSHttpAdapter({
   basePath: `host1/api`
}))
store.registerAdapter('http', new DSHttpAdapter({
  basePath: `host2/api`
}), { default: true });

@rkingon
Copy link

rkingon commented Apr 12, 2018

@jmdobry i am trying to do the same and do it exactly as you mention above... my issue is that one API requires an auth token in the headers and the other doesn't. however- both adapters are sharing the httpConfig defaults. This is sending the apiKey to both adapters and one doesn't allow that header key which results in an error. Any recommendations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants