Skip to content

feat: add LUA script Envoy extension support for API gateway#22288

Closed
Vikramarjuna wants to merge 1 commit intomainfrom
vikram/api-gateway-lua-support
Closed

feat: add LUA script Envoy extension support for API gateway#22288
Vikramarjuna wants to merge 1 commit intomainfrom
vikram/api-gateway-lua-support

Conversation

@Vikramarjuna
Copy link
Copy Markdown
Contributor

Description

Extended LUA Script Envoy extension support for API Gateway

Testing & Reproduction steps

  1. Create a cluster with API gateway
  2. Inject LUA script to API gateway using either service defaults or proxy defaults. Sample script:
{
    name     = "builtin/lua"
    required = true
    arguments = {
      proxyType = "api-gateway"
      listener  = "outbound"
      script    = <<EOT
        function envoy_on_response(response_handle)
          if response_handle:headers():get(":status") == "404" then
              response_handle:headers():replace(":status", "200")
              local json = '{"message":"Modified by Lua script","status":"success"}'
              response_handle:body():setBytes(json)

              response_handle:headers():remove("x-envoy-upstream-service-time")
              response_handle:headers():remove("x-powered-by")
              response_handle:headers():replace("cache-control", "no-store")
              response_handle:headers():remove("content-length")
              response_handle:headers():replace("content-encoding", "identity")
              response_handle:headers():replace("content-type", "application/json")
          end
        end
      EOT
    }
  }
  1. Request a non-existent page and see that the response is as provided in the LUA script and headers are modified as per the script.

Links

https://hashicorp.atlassian.net/browse/NET-12465

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@Vikramarjuna Vikramarjuna requested a review from a team as a code owner April 23, 2025 16:27
@hashicorp-cla-app
Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


Vikram Malapati seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA.
If you have already a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@github-actions github-actions bot added the theme/envoy/xds Related to Envoy support label Apr 23, 2025
@Vikramarjuna Vikramarjuna deleted the vikram/api-gateway-lua-support branch April 23, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/envoy/xds Related to Envoy support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant