Redirect request to a complex multi parameter URL (like an AWS S3 presigned URL)

Is that possible?

I am thinking about doing this:

a. Client requests a file from S3 bucket.

b. Phoenix should call AWS to get a pre-signed URL.

c. Redirect the client to the pre-signed URL.

Here’s an example pre-signed URL:

https://presignedurldemo.s3.eu-west-2.amazonaws.com/image.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJWZ7B6WCRGMKFGQ%2F20180210%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20180210T171315Z&X-Amz-Expires=1800&X-Amz-Signature=12b74b0788aa036bc7c3d03b3f20c61f1f91cc9ad8873e3314255dc479a25351&X-Amz-SignedHeaders=host

How to do that in the controller? Thank you.

Can just redirect to an external URL via redirect(conn, external: "...url..."), where you getting an error with it?

2 Likes

Works perfectly.

1 Like