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

Dynamic redirecting #37

Open
letto4135 opened this issue Jun 28, 2022 · 1 comment
Open

Dynamic redirecting #37

letto4135 opened this issue Jun 28, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@letto4135
Copy link

letto4135 commented Jun 28, 2022

The docs show that you can do this

// redirects "/oh/hi/mark" to "/oh/bye/mark"
Redirect::new("/oh/hi/mark", "../../bye/mark");

A nice thing to be able to do would be would be more dynamic redirects.
Examples:

// redirects "/redirect/me/to/here" to "https://hello.com/me/to/here"
Redirect::new("/redirect", "https://hello.com/../../..")
// redirects "/redirectme/tohere" to https://hello.com/tohere"
Redirect::new("/redirectme", "https://hello.com/..")
// redirects /redirect/me/to/here to "https://hello.com/redirect/me/to/here"
Redirect::new("/redirectme", "https://hello.com/**")
@robjtede
Copy link
Owner

robjtede commented Jul 3, 2022

The redirect service does not pattern match.

The example:

Redirect::new("/oh/hi/mark", "../../bye/mark");

literally sends the header Location: ../../bye/mark back to the client. It is up to them to resolve this and make the follow-up request.

I can see the use case for a more dynamic redirect system that does match patterns. If this is what you are looking for, I'd suggest re-wording the issue and we can turn this into a feature request.

Regarding preserving body, it is irrelevant because this is not intended to be a proxy. It only serves redirect responses.

@letto4135 letto4135 changed the title Redirect does not preserve body/form data and append path to end of Redirect Dynamic redirecting Jul 10, 2022
@robjtede robjtede added the enhancement New feature or request label Aug 9, 2022
Repository owner deleted a comment from sherlok235 Feb 23, 2024
Repository owner deleted a comment from sherlok235 Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants