kongfig icon indicating copy to clipboard operation
kongfig copied to clipboard

Fix custom protocol and host when API has next pages, fixes #118

Open CyExy opened this issue 7 years ago • 6 comments

fixes #105, #118

CyExy avatar Feb 28 '18 22:02 CyExy

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:200 parameter)

theoskolnik avatar Mar 04 '18 19:03 theoskolnik

I am having the same problem too, it would be great if this issue gets fixed soon.

uohzxela avatar May 06 '18 15:05 uohzxela

I'll do a release tomorrow.

CyExy avatar May 06 '18 19:05 CyExy

Hello,

Is this issue fixed with 1.5.3?

Thanks

mynameisgv avatar Jun 27 '18 00:06 mynameisgv

@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 avatar Nov 19 '21 16:11 janv8000

@janv8000 Sorry I don't have a link to the issue -- perhaps @CyExy will know if this issue was resolved.

theoskolnik avatar Nov 24 '21 18:11 theoskolnik