Open cuttingedge1109 opened 2 years ago
@cuttingedge1109 thanks for raising this up. We're going to check this as well, and in terms of a possible fix, this will be provided in the same time with the official 4.1 relase.
I see the doc for the GW that shows the polices endpoint but for OSS is it supposed to work? or just files approach? I get 404 when hitting that endpoint.
Thanks!
I see the doc for the GW that shows the polices endpoint but for OSS is it supposed to work? or just files approach? I get 404 when hitting that endpoint.
Thanks!
Yeah, there is no api endpoint defined for policies in stable versions. But you can find that in 4.1.0-rcN
versions. I tested and it works as expected.
@lghiur So i think policies api endpoint part in the doc should be removed because 4.0 doesn't support policy api endpoint yet.
@cuttingedge1109 thanks for pointing that out, we will work in removing the policies endpoint documentation!
This was opened for release candidate version. Closing this thread as this already works in full release versions from 4.1.0 and above.
I use version 4.3.3, and this still does not work.
curl --location 'http://localhost:8888/tyk/policies' \
--header 'x-tyk-authorization: xxx' \
--header 'Content-Type: application/json' \
--data '{
"id": "app_repository_jwt_policy",
"name": "app_repository_jwt_policy",
"org_id": "default",
"rate": 1000,
"per": 1,
"quota_max": -1,
"quota_renewal_rate": 60,
"access_rights": {
"app_repository_jwt": {
"api_id": "app_repository_jwt",
"versions": [
"Default"
]
}
}
}'
Response:
{
"key": "app_repository_jwt_policy",
"status": "ok",
"action": "added"
}
List system policies:
curl --location 'http://localhost:8888/tyk/policies' \
--header 'x-tyk-authorization: xxx'
Response:
[]
It works after defining the policy_path
in the tyk.conf
. Otherwise, Tyk does not know how to save the policy.
It would be less irritating if the API returned an error if that setting was missing.
Hi @konsti
Thanks for reporting this - and the fix that you found!
We'll review the opportunity to improve the documentation to ensure that others don't hit this problem - and I've logged the suggestion of an error message which we will aim to implement when we have bandwidth.
We're always open to PRs from the community, if you fancy giving it a try to get this in more quickly?
Thanks for supporting Tyk!
Branch/Environment/Version
Describe the bug I tried to create policies using Gateway API, more specifically
/tyk/policies
. The api returns http code 200 but i cannot find policy added.Reproduction steps Steps to reproduce the behavior:
It returns
But i cannot find that in the policy list. Even after reboot or reload gateway.
Expected behavior A new policy should be added.
Configuration (tyk config file): I use the default configuration file for oss gateway.