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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CyExy
Copy link
Contributor

@CyExy CyExy commented Feb 28, 2018

fixes #105, #118

Copy link

@theoskolnik theoskolnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While fixing the URI is a potential solution, Kong should be giving back an appropriately formed url for that "next" value, and I don't think Kongfig should necessarily have the responsibility of changing that value.

@theoskolnik
Copy link

theoskolnik commented Mar 4, 2018

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:

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)

Copy link

@jochen42 jochen42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like. all url-parts included and usage of existing url-utils. i personally prefer a function name like 'getNextUrl' instead of 'fixNext'

@uohzxela
Copy link

uohzxela commented May 6, 2018

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

@CyExy
Copy link
Contributor Author

CyExy commented May 6, 2018

I'll do a release tomorrow.

@mynameisgv
Copy link

mynameisgv commented Jun 27, 2018

Hello,

Is this issue fixed with 1.5.3?

Thanks

@janv8000
Copy link

@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.

@theoskolnik
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Kongfig apply fails when paging required
6 participants