Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Gateway API supported filters for HTTPRoutes #2378

Closed
sgayangi opened this issue May 27, 2024 · 5 comments
Closed

Support for Gateway API supported filters for HTTPRoutes #2378

sgayangi opened this issue May 27, 2024 · 5 comments

Comments

@sgayangi
Copy link
Contributor

Description:
As specified in https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.HTTPRouteFilter, APK needs to be tested for the features it currently supports as well as what could potentially be supported as well.
This also needs to be added from the apk-conf level as well.

@sgayangi sgayangi self-assigned this May 27, 2024
@sgayangi
Copy link
Contributor Author

sgayangi commented May 27, 2024

There are 5 filters in total:

Of these 5,

  • ExtensionRef
  • HTTPURLRewriteFilter
  • HTTPHeaderFilter (add, set and remove)
    are functional in APK.

The sample HTTPRoute filters used for testing HTTPHeaderFilter are given below:

  1. requestHeaderModifier:
- type: "RequestHeaderModifier"
  requestHeaderModifier:
    add:
      - name: X-Request-Custom-Header
        value: "Request-Custom-Header"
    set:
      - name: User-Agent
        value: "Replaced existing value for user agent"
    remove: ["Postman-Token"]
  1. responseHeaderModifier:
- type: "ResponseHeaderModifier"
  responseHeaderModifier:
    add:
      - name: X-Response-Custom-Header
        value: "Response-Custom-Header"
    set:
      - name: data
        value: "Replaced existing value for data from backend response"
    remove: ["access-control-allow-credentials"]

@sgayangi
Copy link
Contributor Author

sgayangi commented May 27, 2024

HTTPRequestMirrorFilter

  • Mirrors requests to the backends specified under the filter
  • Needs to be given a backendRef to mirror the request to
  • The request is sent to the original backendRef provided under the rule as well
  • However, the responses from the backend provided under the filter will be ignored; only the response from the original backend will be sent back to the client.

Sample:

- type: "RequestMirror"
  requestMirror:
    backendRef:
      group: "dp.wso2.com"
      kind: "Backend"
      name: "backend-736990a5eefb375887fdb20008ff04c43a8d3796-api"

https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/route-mirror

@sgayangi
Copy link
Contributor Author

sgayangi commented May 28, 2024

HTTPRequestRedirectFilter

  • Redirects the request to the specified URL
  • Cannot be used on the same rule as a URLRewrite
  • Cannot have a backendRef in that match either
- type: "RequestRedirect"
  requestRedirect:
    scheme: "https"
    hostname: "webhook.site"
    path:
      type: "ReplaceFullPath"
      replaceFullPath: "/e961947c-0607-4d9d-9fe9-c7489cba84f8"
    port: 443
    statusCode: 301

@sgayangi
Copy link
Contributor Author

sgayangi commented Jun 18, 2024

Subtasks

@sgayangi
Copy link
Contributor Author

Fixed with PR #2392

@CrowleyRajapakse CrowleyRajapakse added this to the 1.2.0-m1 milestone Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done/Done
Development

No branches or pull requests

2 participants