Questions tagged [kong-plugin]

168 questions
0
votes
1 answer

Post-function custom lua code to manipulate JSON response body

I’m trying to write a custom plugin to transform response body. I could’ve used a response transformer plugin, but my response body json is complex, so I want to remove few fields from it. I tried using post-function plugin to write my custom lua…
0
votes
1 answer

Kong route and upstream server path

I have the following configuration of service with route in Kong: - name: test host: test-service port: 80 protocol: http path: /endpoint/ routes: - name: test_route strip_path: true preserve_host: true paths: …
user1563721
  • 1,373
  • 3
  • 28
  • 46
0
votes
1 answer

Kong conditionally apply plugin for the service and route

I am trying to configure Kong gateway to conditionally apply plugin when the conditions are met. The use-case here is that OIDC plugin should be used only when there is no SSL_CLIENT_CERT header, otherwise do not use OIDC and forward header to the…
user1563721
  • 1,373
  • 3
  • 28
  • 46
0
votes
0 answers

Redis connection closed exception in lua plugin

I try to use the next simple example: local redis = require "resty.redis" function _M.execute(plugin_conf) local red = redis:new() red:set_timeout(redis_timeout) local ok, err = red:connect(redis_host, redis_port) if not ok then …
Yulia
  • 11
  • 3
0
votes
1 answer

How to hit curl to Kong after applying RBAC authentication

We have authenticated kong with RBAC credentials. Before this, we are able to hit localhost:8001/default/apis?size=100. But after applying RBAC authentication, we are getting the below error { "message": "Invalid RBAC credentials. Token or User…
Varun Chawla
  • 303
  • 1
  • 6
  • 19
0
votes
1 answer

Kong response-transformer-advanced plugin

I have written the below code in Config.Transform.Functions (response-transformer-advanced plugin) I hard coded for element ( data.statements[1])…how can I make dynamic ( data.statements JSON array. Loop through all cardnum in data.statements[ 1…n…
BALA AP
  • 21
  • 3
0
votes
0 answers

Kong API Gateway - Domain Restriction

I have a Service that is mapped to a consumer, and I want to allow the Service Routes to the specific domain name. We have a plugin to restrict the IP https://docs.konghq.com/hub/kong-inc/ip-restriction/. is there any way to restrict the domain?
Gowtham Raj
  • 103
  • 2
  • 13
0
votes
2 answers

Accessing datastore from Golang plugin

When writing plugins in Lua there is the kong.db module available to access the Kong's underlying database. I assume that it also should be possible to communicate with the DB from within plugins written in Go. Or am I wrong here? If it's possible…
Stanislau
  • 402
  • 1
  • 5
  • 16
0
votes
0 answers

How to fetch API from swagger file using kong gateway

I have create a service, a route, an auth, a consumer, a username and a password in the kong admin UI through curl command. Below there is the command that I have used and it's showing in the kong admin UI. I have installed Kong as docker container…
Mohd Rashid
  • 101
  • 2
  • 9
0
votes
1 answer

kong header base rate limiting

I want to apply rate limiting by header. if X-yunus-api-key == fasdasd231jnde32e32e , apply rate limit. Does Kong has this feature ? --header 'Cache-Control: no-cache' \ --header 'X-yunus-api-key: fasdasd231jnde32e32e' \ --header 'Content-Type:…
user10651098
  • 75
  • 1
  • 7
0
votes
1 answer

Install & use rate-limiting plugin in Kong using the declarative format

I am trying to enable rate-limiting plugin in Kong. However, I keep getting the error - 'name': plugin 'rate-limiting' not enabled; add it to the 'plugins' configuration property I am deploying kong as a containerised service orchestrated by docker…
Aditya Mishra
  • 1,687
  • 2
  • 15
  • 24
0
votes
1 answer

Is it possible to have placeholders in kong plugin k8s?

apiVersion: extensions/v1beta1 kind: Ingress metadata: name: kong-ingress-test annotations: kubernetes.io/ingress.class: "kong-ingress" konghq.com/strip-path: "true" namespace: test spec: rules: - host: test.com http: …
cUser
  • 392
  • 8
  • 25
0
votes
1 answer

How to return a static response in kong api-gateway

I am using kong API-gateway in its DB-Less mode as a result, I have a kong.yaml file as below: _format_version: "2.1" _transform: true services: - name: service1 url: http://service1:port/sample-path routes: - name: service1 …
Amin Ba
  • 1,603
  • 1
  • 13
  • 38
0
votes
1 answer

Where to store sensitive information in kong api-gateway declarative mode

I am trying to use key-auth and acl plugins of kong in a db-less declarative manner. In kong.yml I have: _format_version: "2.1" _transform: true services: - name: gamma-live host: gamma port: 8000 protocol: http path: /live …
Amin Ba
  • 1,603
  • 1
  • 13
  • 38
0
votes
2 answers

How to do conditional request termination with kong api-gateway?

I am using kong API-gateway for API management. Suppose I have a service named alpha. I am serving kong on port 80 and alpha on port 8000 both in the same docker network named kong-net and each on a different docker container, one named kong and the…
Amin Ba
  • 1,603
  • 1
  • 13
  • 38