Kong Functions (Pre-Plugins)

lets you dynamically run Lua code from Kong, before other plugins in each phase.

for eg. removing the header if it is blank.

local k_request = kong.request.get_header("Content-Type")

if k_request and (k_request == "application/json") then
  local check_head = kong.request.get_raw_body()
  if (not check_head) or (check_head == "") then
    kong.service.request.clear_header("Content-Type")
  end
end

Published by

Leave a Reply

Your email address will not be published. Required fields are marked *