Warp dynamic redirect

I'm trying to have a user click a link that will generate a uuid to be appended to a redirect URI.
So user clicks link to /new_user and is rerouted to /user/random_uuid. This has proven unexpectedly difficult. The warp::redirect() convenience function takes an impl AsLocation parameter, but that trait is not defined anywhere that I can find. Does anyone know how to make this happen?

AsLocation is implemented for Uri, so you can build any Uri you like and redirect:

let user_id = uuid::Uuid::new_v4();
let location = Uri::from_str(&format!("/user/{}", user_id)).unwrap();
1 Like

Thanks, I was having an issue with https on my localhost. I guess my certificate expired or something.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.