Frameio / cloudfront-signer

MIT License
9 stars 9 forks source link

Signed URLS Not Working Fully #6

Open johnmcguin opened 8 months ago

johnmcguin commented 8 months ago

Thank you for this library. I wrestled with it quite a bit but have learned a lot along the way.

Description

I have a phoenix 1.7.9 project. Early on in the project, I installed this library and wrote a function to test the integration of my AWS services with my context code. It worked so I was pumped and moved on. Fast forward a few weeks to the point where I was beginning to integrate these services into my web application and I encountered an odd behavior that I still can't fully explain. The URL generation continues to work in an iex session while it fails with a 403 error when called over http. After a lot of time debugging and investing primarily in the AWS side, I was pretty confident in my AWS config and the fact that it did work in iex told me something. So, I looked more closely into the library and just noticed that there has not been a lot of recent activity. I didn't think much of it at the time evaluating the library, but decided to try to pull the library files in as local modules. Along the way, I made one main opportunistic change to use Jason instead of Poison since the Phoenix project comes with Jason already. After pulling in the code locally, my endpoint now works. It leaves me with a question of whether to just use the local code and move on, or see if I could help out in any way. I speculate it could be something with the policy signing but am not sure.

Environment

Erlang/OTP 26 [erts-14.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] Elixir 1.15.6 (compiled with Erlang/OTP 26)

Current Behavior

Given the above, a phoenix controller action that returns the URL as a plain text response does not work.

Expected Behavior

A controller action returning the URL should work.

Possible Solution

I wish I had more ideas.

johnmcguin commented 3 months ago

Long overdue, but I patched this locally in a project and have just started using this as a remote fork at: https://github.com/johnmcguin/cloudfront-signer. I had more consistent results using a custom policy instead of the canned policy the library provided.