amazon-s3 - s3 presinged url nginx反向代理错误 - SignatureDoesNotMatch
问题描述
我想使用 pdfjs 在浏览器中显示来自 s3 的 pdf - https://mozilla.github.io/pdf.js/ 代替使用 s3 URL,我有这样的反向代理
网址 www.my-site-url.com/public/s3-presinged-url-bucket-part-with-sign-info
NGINX 块
location /public {
proxy_pass https://XXXX.s3.us-west-2.amazonaws.com/;
}
但是 S3 抛出错误
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
如何正确反向代理它?
解决方案
在代理到预签名的 S3 url 时,我遇到了类似的情况。一切都在开发机器上运行,但在生产中失败了,因为 CloudFront 添加了更改签名的额外标头。在我的例子中,因为我已经有了有效的预签名 URL,只要标头未被干扰,我添加proxy_pass_request_headers off;
了使代理请求大致相当于直接 GET 请求。
推荐阅读
- ceph - 从失败的 Ceph 集群中恢复 - 非活动 PG(关闭)
- batch-file - 如何以编程方式运行具有管理员权限的批处理脚本?
- r - RODBC oracle 架构与安装的双客户端不匹配
- java - 如何使用 Selenium Java 使用 Krypton 捕获屏幕截图
- google-apps-script - getActiveRange 不返回当前选择
- python - 从命令行运行 python 模块
- angular7 - Angular:如何为关联数组做 *ngFor
- html - 有什么方法可以设置 :nth-child(an + b) 选择器的子元素?
- android - FirebaseMessaging 服务(后台服务)中的 SharedPreferences
- ruby - 无法通过终端运行 gem