Retrieve the final destination URL from HTTPoison after forward

With HTTPoison is it possible to retrieve the final destination URL after a redirect (302, 307, 308, etc)? I would like to store the destination URL for future calls.

It’s traditionally in the Location header, which of course could forward somewhere else so just testing is how you’d do it.

If I have follow_redirect set on, you are indicating I can retrieve the location header from the response to get where the client finally landed? Or do I look back at the request?

That’d work, I usually keep it off because I like to log paths I take… >.>
You can probably get it somehow but unsure how, worst case just turn that off and loop through the redirects until it’s resolved (or you hit a max recursion count in case redirects bounce back and forth between each other, which some websites do…).

1 Like

With :follow_redirect there is no way that I know of to get the final URL.