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

RequestRedirect filter on HTTPRoute cannot preserve path in request #6557

Closed
3 of 4 tasks
randmonkey opened this issue Oct 22, 2024 · 5 comments · Fixed by #6804
Closed
3 of 4 tasks

RequestRedirect filter on HTTPRoute cannot preserve path in request #6557

randmonkey opened this issue Oct 22, 2024 · 5 comments · Fixed by #6804
Assignees
Labels
area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API
Milestone

Comments

@randmonkey
Copy link
Contributor

randmonkey commented Oct 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Does this enhancement require public documentation?

  • I have added an Acceptance Criteria item for adding and/or adjusting public documentation (if applicable)

Problem Statement

From FTI-6305.
Because the RequestRedirect filter is implemented by request-termination and response-transformer plugin. This cannot include variable part in the response head. So the redirect path in the response body is fixed and cannot preserve path in the request.

Proposed Solution

  • Use some other method to generate redirect response that can send variable response according to the request
    • For example: run a standalone server to send responses

Additional information

No response

Acceptance Criteria

  • Redirect path in the response header can be preserved if no path is given
  • ReplacePrefixMatch is also supported
@randmonkey randmonkey added area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API labels Oct 22, 2024
@randmonkey randmonkey added this to the KIC v3.4.x milestone Nov 7, 2024
@mheap
Copy link
Member

mheap commented Nov 19, 2024

Can this be implemented with a pre-function plugin?

kong.response.exit(301, 'redirecting', {['Location'] = 'https://other.example.com/' .. kong.request.get_path_with_query()})

@randmonkey
Copy link
Contributor Author

randmonkey commented Nov 22, 2024

@mheap has submitted a PR for adding a redirect plugin: Kong/kong#13900
Using the plugin (only for Kong 3.9, or other version that contains the plugin) should resolve this.
If Kong does not support this plugin, we should either:

  • Do not support it and report a translation error
  • Implement by pre-function plugin
    @mheap Which one do you think is the better resolution?

@mheap
Copy link
Member

mheap commented Nov 22, 2024

I think we should leave the existing implementation pre 3.9, and use the new plugin in 3.9+.

pre-function is used enough that I would not want to prevent users using it if adding redirects

@randmonkey
Copy link
Contributor Author

Now Kong/kong#13900 is merged and we can use the redirect plugin if Kong version is above or equal to 3.9. However, the plugin seems still cannot satisfy the replacePrefixMatch. @mheap do we have plan to support it?

@lahabana
Copy link
Contributor

lahabana commented Dec 9, 2024

Let's just move support for ReplacePrefixMatch to a future release and do just redirect in 3.4 to be able to close the FTI.

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
Projects
None yet
4 participants