Heroku Amazon S3 文件服务器如何做路由?

发布于 2024-12-04 19:03:47 字数 282 浏览 7 评论 0原文

如何使用 Amazon S3 文件服务器进行路由?

我已将摄影师文件夹上传到 Amazon S3。

我的公共字典中有文件夹:

photographer

在摄影师中我有文件夹:

flv
images
quicktime

我已将摄影师文件夹上传到 Amazon S3。

如何让 Heroku 与 Amazon S3 配合使用并拥有与文件夹摄影师位于公共目录中相同的路由?

How to do routes with Amazon S3 fileserver?

I have uploaded my photographer folder to Amazon S3.

My public dictory I had the folder:

photographer

And in photographer I had the folders:

flv
images
quicktime

I have uploaded the photographer folder to Amazon S3.

How do I get Heroku to work with Amazon S3 and have the same routes as if the folder photographer was in the public directory?

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

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

发布评论

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

评论(2

挽袖吟 2024-12-11 19:03:47

我假设这些文件是静态资产,在这种情况下,您可以在 production.rb(如果您愿意,还可以在development.rb)中定义资产主机,如下所示:

config.action_controller.asset_host = "http://bucketname.s3.amazonaws.com/"

I'm going to assume these files are static assets in which case you define an asset host as following in production.rb (and development.rb if you like):

config.action_controller.asset_host = "http://bucketname.s3.amazonaws.com/"
错爱 2024-12-11 19:03:47

一种方法是从请求中获取参数(哪个子文件夹和文件名),然后将请求重定向到相应的 S3 地址。 RailsGuides 的重定向部分提供了一些关于此的有用信息。

One way is to grab the parameters (which subfolder and the filename) from the request and then redirect the request to the corresponding S3 address. There is some good information on this in the redirection section at RailsGuides.

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