-
Notifications
You must be signed in to change notification settings - Fork 116
Filter: path support for RequestRedirectFilter #1413
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
Comments
@Imesh7 Nobody is currently working on this issue, feel free to take a look at it! Thanks for your interest! |
Hi @sjberman , |
@Imesh7 The |
Proposal to solve the Issue1. add Path field to HTTPRequestRedirectFilter struct , type is pointer to HTTPPathModifier
2. configure nginx Existing function Proposed function (Please read the comments on the below function)
@sjberman |
I think the approach in general is on the right track. We'll know for sure once we start testing all the variants in the example table to see if they redirect properly. A few things to note:
|
@sjberman I have a question,
for the |
What I mean is that you don't need to use the regexp library and call The @pleshakov Do you know if there's a way in nginx to capture the path segments without using a regex location path, so that we can append them to the redirect path? I'm not finding anything, so we may have to update this specific location block to use a regex path, just so we can capture the request path segments if they exist. |
@sjberman I woudn't use regex location, because they change how request matching is processed https://nginx.org/en/docs/http/ngx_http_core_module.html#location what if we just use rewrite directive to rewrite uri of the request, similar to what we do in the rewrite filter? |
@pleshakov The expectation with a redirect is a 3xx response and the client performs the redirection. A rewrite happens server-side and the client is unaware. |
yep, so we do rewrite the same way, but then perform a redirect. So something like below. Would that work? server {
listen 8093;
location /foo {
rewrite ^/foo(.*)$ /xyz$1;
return 302 $uri;
}
}
|
@pleshakov Oh I see, yeah that looks like it could work. I'm curious if there is much of a performance difference doing it this way versus a regex location with just a return. Regarding the regex location, what specifically should we be worried about in regards to the matching? Is it the case of a user specifying |
regex location can mess up prefix matching, because if it matches, all prefix locations will be ignored. Please see https://nginx.org/en/docs/http/ngx_http_core_module.html#location server {
listen 8094;
location /hello/abc {
return 200 "hello/abc\n";
}
location ~^/hello {
return 200 "hello\n";
}
}
|
@pleshakov Understood. This will make regex path support very interesting in the future... |
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Moving to backlog as there has been no PR activity. |
As a user of NGF
I want to have a RequestRedirect Filter for my paths for my API
So that I can redirect using paths.
Acceptance
path
option of the RequestRedirect filter is implemented as defined for HTTP Routes here.requestRedirect
filter.The text was updated successfully, but these errors were encountered: