Skip to content

Instantly share code, notes, and snippets.

@gszr
Created December 18, 2025 14:55
Show Gist options
  • Select an option

  • Save gszr/26f96b1625c0be7bff5993e714da660a to your computer and use it in GitHub Desktop.

Select an option

Save gszr/26f96b1625c0be7bff5993e714da660a to your computer and use it in GitHub Desktop.
plugins:
- tags: ~
protocols:
- grpc
- grpcs
- http
- https
consumer_group: ~
route: ~
ordering: ~
consumer: ~
enabled: true
name: request-callout
ws_id: 485194e7-26fc-4e5b-8254-905c57f6e9e5
id: 825c4329-8d5b-45b3-8582-c08f2494ecfb
service: ~
updated_at: 1765974224
instance_name: ~
config:
callouts:
- request:
error:
on_error: fail
error_response_msg: service callout error
retries: 2
http_statuses: ~
error_response_code: 400
http_opts:
timeouts: ~
ssl_verify: false
proxy: ~
ssl_server_name: ~
body:
decode: false
custom: ~
forward: false
url: 'https://mocki.io/v1/0e318491-8647-4027-b171-89b85464a10c '
query:
forward: false
custom: ~
method: GET
headers:
forward: false
custom: ~
by_lua: ~
depends_on: []
response:
body:
decode: true
store: true
by_lua: ~
headers:
store: true
name: c1
cache:
bypass: false
upstream:
query:
forward: true
custom: ~
body:
decode: true
custom:
user_id: $(callouts.c1.response.body.user_id)
username: $(callouts.c1.response.body.username)
forward: true
headers:
forward: true
custom: ~
by_lua: |
local callout_body = kong.ctx.shared.callouts.c1.response.body
local consumer = { id = callout_body.user_id, username = callout_body.username }
if not consumer or not consumer.id then
return kong.response.exit(401, { message = 'Unauthorized' })
end
kong.client.authenticate(consumer);
kong.service.request.set_authentication_headers(consumer)
cache:
cache_ttl: 300
redis:
sentinel_master: ~
server_name: ~
ssl: false
sentinel_nodes: ~
cluster_nodes: ~
cluster_max_redirections: 5
cluster_addresses: ~
connection_is_proxied: false
sentinel_addresses: ~
timeout: 2000
cloud_authentication: ~
keepalive_pool_size: 256
database: 0
ssl_verify: false
sentinel_username: ~
password: ~
connect_timeout: 2000
send_timeout: 2000
read_timeout: 2000
sentinel_password: ~
sentinel_role: ~
host: 127.0.0.1
port: 6379
keepalive_backlog: ~
username: ~
memory:
dictionary_name: kong_db_cache
strategy: 'off'
created_at: 1765974224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment