I currently have a WCF web API that I have split into two versions. The first version runs at api.mysite.com. The second is currently not published to production.
I would like a way to publish the second API such that requests to the first version are non-interrupted. My ideas would be to add a x-api-version
header and internally route the request to the designated API. If there is no header, then default to version 1. I considered adding /v1
or /v2
to the beginning of the path to delimit the version such that a request to v1 or v2 might look like:
http://api.mysite.com/v1/authentication/login
http://api.mysite.com/v2/auth/login
The only caveat is that requests without the version must work and default to version 1 (or whatever version I specify).
Although this sounds good (to me at least), I'm not sure on what the recommended way of implementing this would be. I know that I could always do some sort of reverse proxy but, I'm hoping that my solutions can be a programatic one. The less configuration that is required on the part of the server, the better. If anyone has any ideas or links to blogs/tutorials, that would be fantastic!
Thanks in advance!