kongfig
kongfig copied to clipboard
Fix custom protocol and host when API has next pages, fixes #118
fixes #105, #118
We realized that the "next" url that appears in paginated responses was Kong not giving back the correct url, and this is the temporary solution we've implemented:
Solution 1 (desired solution)
For securing calls to the API gateway, Kong recommends that you register an Admin API in Kong that has an upstream to the Management API and apply key-auth to it. This was particularly problematic when we tried preserving the hostname for the “next” key, but then our Kongfig calls were going to “https://hostname/apis”, which does not work with our solution. What we really wanted was "https://hostname/kong-admin/apis", and Kong currently does not have a solution for that and they're working on putting something together.
Solution 2 (current solution)
There’s a request-transformer plugin that can inject configured parameters before any request gets to the Kong proxies; in our case, we are increasing the pagination limit size to 200 objects (this is above our number of APIs) for every GET request to avoid relying on the “next” value. We also had to create a completely separate API in Kong for this plugin because we learned that the size parameter can only be applied to GET requests - and will error out for POSTS with {"size":"size is an unknown field"}.
It has almost the same configuration as the Admin API, the only difference being that this API is solely responsible for making all GET requests. As far as precedence, incoming GET requests will always be routed through this second Admin GET API instead of the original Admin API.
The Admin API:
- Name: kong-admin
- URIs: kong-admin
- Upstream url: https://localhost:8444
- Plugins: key-auth
The Admin GET API:
- Name: kong-admin-get
- URIs: kong-admin
- Methods: GET
- Upstream url: https://localhost:8444
- Plugins: key-auth, request-transformer (passes
size:200parameter)
I am having the same problem too, it would be great if this issue gets fixed soon.
I'll do a release tomorrow.
Hello,
Is this issue fixed with 1.5.3?
Thanks
@theoskolnik : do you happen to have a link to the issue or PR where the Kong team is tracking the following?
and Kong currently does not have a solution for that and they're working on putting something together.
@janv8000 Sorry I don't have a link to the issue -- perhaps @CyExy will know if this issue was resolved.