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

convert the core filter RequestRedirect to the proper Kong plugin #2799

Closed
1 of 2 tasks
mlavacca opened this issue Aug 10, 2022 · 6 comments
Closed
1 of 2 tasks

convert the core filter RequestRedirect to the proper Kong plugin #2799

mlavacca opened this issue Aug 10, 2022 · 6 comments
Assignees
Labels
area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API area/spike

Comments

@mlavacca
Copy link
Member

mlavacca commented Aug 10, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Problem Statement

We should support the core HTTPRoute filter RequestRedirect to be compliant with Gateway API. The core filter RequestHeaderModifier has already been supported in KIC by means of a kong plugin, and we should do the same for this filter.

Proposed Solution

Extend the function generatePluginsFromHTTPRouteRuleFilters to support the filter RequestRedirect

Additional information

#2793 (comment)
#2793 (comment)

Acceptance Criteria

  • the core filter RequestRedirect is translated to the proper Kong plugin
@mlavacca mlavacca added area/feature New feature or request area/spike area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API labels Aug 10, 2022
@mlavacca mlavacca added this to the Gateway API - Milestone 3 milestone Aug 10, 2022
@randmonkey
Copy link
Contributor

randmonkey commented Aug 15, 2022

Searched for all free plugins in plugin hub, there was no plugins that fully satisfy the requirements of RequestRedirect. According to the comments in #2793 (comment) and some investigation, the possible implementation of this feature would be :

  • Run a server to return such redirect responses, and use request transformer to set fixed fields in request header.
  • Use serverless functions to write our own code to return redirect response
  • Similar to above, use request transformer to set fixed fields in request header, and use a custom plugin to fill in the fields from request and return the response.

@randmonkey randmonkey self-assigned this Aug 17, 2022
@randmonkey randmonkey removed this from the Gateway API - Milestone 3 milestone Aug 19, 2022
@randmonkey
Copy link
Contributor

After investigation, currently the RequestRedirect feature could NOT be implemented using one or combination of existing free plugins of kong gateway (except for the serverless functions, but this allows running custom lua code, which is insecure). So, we decided not to include this feature in the upcoming 2.6.0 release of KIC.

@mflendrich
Copy link
Contributor

not blocked anymore - @randmonkey has a solution proposal (can you please post it here?)

@randmonkey
Copy link
Contributor

randmonkey commented Oct 11, 2022

One possible method to implement RequestRedirect filter: Run a server from KIC to return redirect responses, and use RequestModifier plugin to carry the specifications to the redirect server.
When a rule uses RequestRedirect, we generate a route sending traffic to KIC redirect server, and carry the settings of filter using RequestModifier plugin to add headers (if the corresponding field presents. When the fields are configured, they remain unchanged until HTTPRoute resource modified):

  • X-Kic-Redirect-Scheme for Scheme field
  • X-Kic-Redirect-Hostname for Hostname
  • X-Kic-Redirect-Path-Modifier-Type for Path.Type
  • X-Kic-Redirect-Path-Replace-Fullpath for Path.ReplaceFullPath
  • X-Kic-Redirect-Path-Replace-Prefixmatch for Path.ReplacePrefixMatch
  • X-Kic-Redirect-Port for Port
  • X-Kic-Redirect-Statuscode for StatusCode
    When a request to that path came to Kong, it first go through the RequestModifier plugin to add the header carrying the settings. Then the request with added headers is proxied to KIC redirect server, then KIC server use the header and original request to generate and return the redirect response.

@mheap
Copy link
Member

mheap commented May 5, 2023

@mlavacca Is this core or extended conformance?

@mlavacca
Copy link
Member Author

mlavacca commented May 5, 2023

This is core and has already been fixed by ##3702. We can close it 🎉

@mlavacca mlavacca closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API area/spike
Projects
None yet
Development

No branches or pull requests

5 participants