在 Heroku 上使用 redmine_s3 插件时出现 403 错误

发布于 2024-11-28 19:48:35 字数 1534 浏览 2 评论 0原文

我正在运行 Redmine(来自 http://github.com/edavis10/redmine 的 1.2-stable 分支) Heroku 并希望使用 redmine_s3 插件 (https://github.com/tigrish/redmine_s3) 将资产存储在 S3 上。

我使用本指南进行设置: http:// /blog.firsthand.ca/2010/10/installing-redmine-on-heroku-with-s3.html

它在本地运行得很好,当我启动Redmine(在生产环境中)时,它会创建配置的存储桶并存储我上传到那里的任何资产。

但是当我尝试在 Redmine 上运行它时,它在第一次向 Heroku 请求时崩溃了

/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 403 "Forbidden" (Net::HTTPServerException)
from /app/vendor/plugins/redmine_r3/lib/S3.rb:306:in `block in make_request'
from /usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:627:in `start'
from /app/vendor/plugins/redmine_r3/lib/S3.rb:281:in `make_request'
from /app/vendor/plugins/redmine_r3/lib/S3.rb:157:in `create_bucket'
from /app/vendor/plugins/redmine_r3/lib/redmine_s3/connection.rb:57:in `create_bucket'
from /app/vendor/plugins/redmine_r3/init.rb:17:in `block in <top (required)>'

有问题的行在这里: https://github.com/tigrish/redmine_s3/blob/master/lib/S3.rb#L306

我仔细检查了配置Heroku 和我的本地计算机上的(S3 凭证、存储桶名称等)完全相同。 我尝试了不同的存储桶名称和 S3 凭据,仍然出现相同的错误。 Redmine 本身(没有 redmine_s3 插件)在 Heroku 中工作得很好。 只要我添加插件...繁荣!

我怀疑从 Heroku 到 S3 的请求有一些奇怪的标头或其他属性,导致 S3 拒绝该请求。

谁能证实或否认这一点? 如果有任何关于如何实现这项工作的想法,我会很高兴。

I am running Redmine (1.2-stable branch from http://github.com/edavis10/redmine) on Heroku and want to use the redmine_s3 plugin (https://github.com/tigrish/redmine_s3) to store the assets on S3.

I used this guide for the setup: http://blog.firsthand.ca/2010/10/installing-redmine-on-heroku-with-s3.html

It works great locally, when I start Redmine (in production enivonment) it creates the configured bucket and stores any assets I upload in there.

But when I try to run it on Redmine it crashes on the first request to Heroku

/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 403 "Forbidden" (Net::HTTPServerException)
from /app/vendor/plugins/redmine_r3/lib/S3.rb:306:in `block in make_request'
from /usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:627:in `start'
from /app/vendor/plugins/redmine_r3/lib/S3.rb:281:in `make_request'
from /app/vendor/plugins/redmine_r3/lib/S3.rb:157:in `create_bucket'
from /app/vendor/plugins/redmine_r3/lib/redmine_s3/connection.rb:57:in `create_bucket'
from /app/vendor/plugins/redmine_r3/init.rb:17:in `block in <top (required)>'

The offending line is here: https://github.com/tigrish/redmine_s3/blob/master/lib/S3.rb#L306

I double and triple checked, the configuration on Heroku and my local machine (S3 credentials, bucket name, etc.) is exactly the same.
I tried different bucket names and S3 credentials, still the same error.
Redmine itself (without the redmine_s3 plugin) works just great in Heroku.
Just as soon as I add the plugin... boom!

I suspect that the request from Heroku to S3 has some weird headers or other properties that make S3 reject the request.

Can anyone confirm or deny this?
I would be happy about any ideas on how to make this work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷爱 2024-12-05 19:48:36

试试我的插件的fork,我似乎记得去年有一个类似的问题。它可能会尝试为测试环境创建存储桶,如果您没有在 Heroku 上定义,那么它将失败 (潜在修复)。

Try my fork of the plugin, I seem to remember a problem like that last year. It might be trying to create the bucket for the test environment, which if you didn't define on Heroku then it would fail (potential fix).

半暖夏伤 2024-12-05 19:48:36

最后,这实际上是 Ruby 1.9.2 的问题。当我降级到 1.8.7 后,它就开始工作了! :) 感谢 Jack Chu 在对 Eric Davies 的评论中让我走上了正确的道路。

In the end, it actually was an issue with Ruby 1.9.2. As soon as I downgraded to 1.8.7, it started working! :) Thanks to Jack Chu in the comments to Eric Davies for bringing me on the right track.

千仐 2024-12-05 19:48:35

你的桶在哪个地区?尝试使用美国标准的桶。

我也有同样的麻烦。首先,我使用了位于东京的存储桶,并且收到了相同的错误消息。
我检查了响应代码和正文。响应代码为 409 冲突。错误消息如下。

BucketAlreadyOwnedByYou
Your previous request to create the named bucket succeeded and you already own it.

我认为这个错误意味着 redmine_s3 将尝试创建一个具有您在美国标准中指定的存储桶名称的存储桶。但是,其他区域已经存在同名的存储桶。所以你会得到一个错误。

In which region is there your bucket? Try to use a bucket located in US Standard.

I had same trouble. First, I used a bucket that is located in Tokyo and i got same error message.
I checked response code and body. Response code was 409 Conflict. Error message was below.

BucketAlreadyOwnedByYou
Your previous request to create the named bucket succeeded and you already own it.

I think this error means that redmine_s3 will try to create a bucket that has the bucket name you designated in US Standard. However there is a bucket that has same name in other region already. So you will get a error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文