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

Routing based on Accept Header #155

Closed
wstaples opened this issue Sep 1, 2016 · 2 comments
Closed

Routing based on Accept Header #155

wstaples opened this issue Sep 1, 2016 · 2 comments

Comments

@wstaples
Copy link

wstaples commented Sep 1, 2016

I'm trying out the Dingo API to build a Web App. The way Dingo handles api versions is to define an Accept header with a specific version. There is nothing in the URL to indicate the version. To use curl to get a version would look something like:

curl -v -H "Accept: application/vnd.YOUR_SUBTYPE.v1+json" http://example.app/users

Lets assume that Servers A and B and running the service however Server A has version 1, 2 and 3 but Server B has only version 1. how could I use Fabio to route this app based on its Accept Header (or any custom header I would assume). Maybe this has nothing to do with Fabio and should be handled in the Consul service def. Without changing the URL I'm not sure how I could set this up in consul to handle multiple versions.

@magiconair
Copy link
Contributor

Right now you can't since fabio does not route by header. Adding this to the proxy code isn't the main issue. At present I don't have a way to let you configure this. See #111

The way we're doing this - since we are taking exactly this versioning approach - is to have all services handle all versions. The content type versions should be deprecated over time anyway so ideally you might have only 1-2 versions of a given entity to support.

Do you have this problem right now which prevents you from using fabio or are you considering this a potential roadblock for adoption?

@wstaples
Copy link
Author

wstaples commented Sep 1, 2016

Thank you for the fast response! I would not consider this issue a roadblock. For simplicity sake I'm likely going to force all api servers to handle all versions anyway. This only becomes an issue if a second version of the API actually existed. Again thank you for the fast response.

@wstaples wstaples closed this as completed Sep 1, 2016
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

2 participants