|
|
|
|
|
by pvtmert
29 days ago
|
|
Not a hack at all. In fact, this is how Kubernetes APIs work. Even the CLI asks YAML or JSON content type when `-o yaml` or `-o json` is specified. Also, some other sites (albeit sometimes looking at the User-Agent header, hence more hacky) also doing the same. For example `ipinfo.io` returns HTML page when opened in a browser but a JSON (prettified) when requested via cURL. |
|
There are indeed some limitations to this implementation. The primary one being IPv6 support. The implementation prioritizes convenience over internet limitations, requiring us to roll out IPv6 dual stacking on the web request level as opposed to the DNS level. On an API level, this results in users with IPv6 addresses making API requests to v6.ipinfo.io.
So, last year we rolled out dedicated API infrastructure for api.ipinfo.io