aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 12 forks source link

AWS JS SDK V2 and V3 proxy feature does not work #767

Closed AllanOricil closed 1 week ago

AllanOricil commented 1 week ago

I wrote a simple proxy server in express, and configured AWS SDKs V2 and V3 to send requests through it using an S3 bucket client. However, none of the S3 clients are able to reach the proxy properly.

V2 is able to send requests but I had to set ssl to false in AWS config. Without disabling ssl, HTTPS cant reach HTTP server in localhost. The server has a proxy configured at http://localhost:3000/AWS, and the S3 client proxy env var, used by the SDK client, is set to HTTP_PROXY=http://localhost:3000/AWS. These requests reach the server, however they aren't proxied through /AWS. If I unset HTTP_PROXY env var, the server stops receiving requests from the client.

V3 doesn't even work. I believe it is because it is not possible to proxy HTTPS over HTTP without disabling ssl, like I did in V2. However, I did not find a way to disable ssl on AWS V3. If it is possible to disable it, can you show an example?

There are no docs with specs for the server, or even explaining how to proxy HTTPS to HTTP. So, could AWS provide an example of a proxy server written in JS, and configure both SDK V2 and V3 to use it. I need to create a proxy server that is going to Inject IAM Role Session Credentials before the request is forwarded to AWS, and I'm stuck because I can't make any of the SDK clients to use my proxy.

AllanOricil commented 1 week ago

I was able to make it work. However not using any of the proxyagent libraries recommended by aws docs. The one that worked for me was http-proxy-agent.

github-actions[bot] commented 1 week ago

This issue is now closed.

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.