Amazon S3的URL重写 [英] Amazon S3 Url rewrite

查看:342
本文介绍了Amazon S3的URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何更改Amazon S3的网址从 http://bucket.amazons3.com/imagepath.jpg http://image.mydomain.com/imagepath.jpg

How can I change the Amazon S3 url from http://bucket.amazons3.com/imagepath.jpg to http://image.mydomain.com/imagepath.jpg

编辑: 基本上整个原因是从我的用户隐藏Amazon S3的URL。

Basically the whole reason for this is to hide the amazon s3 url from my users.

我在想一个HTTP模块,将重定向从image.mydomain.com请求到bucket.amazons3.com。但这需要所有请求都被我的服务器来处理第一,然后转发。

I was thinking about a HttpModule that would redirect the request from image.mydomain.com to bucket.amazons3.com. But that would require all requests to be handled by my servers first then forwarded.

推荐答案

如果我的理解,你需要指定你的域名,而不是S3。要做到这一点,你需要编写一个处理程序将作为亚马逊服务器的代理。

If I understand, you need to specify your domain name instead of S3. To do this, you need to write a handler which will act as a proxy to the amazon server.

不过,因为你需要将图像发送到客户端,以及获取用于S3的形象实际上两倍的带宽。

But, that would actually double your bandwidth as you need to send the image to the client as well fetch the image for S3.

我不知道有没有什么具体的S3的方式来处理这个问题。

I am not sure is there any S3 specific way to handle this.

下面是Amazon S3的具体方式取自亚马逊S3,CNAME记录

Below is Amazon S3 specific way taken from Amazon S3, CNAME record

普通用户可以注册   Amazon S3的托管,并开始上传   文件 - 接受默认网址   结构承载的文件:

The average user may sign up for Amazon S3 hosting and begin uploading files - accepting the default URL structure for hosted files:

http://s3.amazonaws.com/your-bucket/some- file.txt的   如果你打算使用S3主办媒体   文件 - 更具体的Flash文件    - 你会碰到Adobe的跨域安全策略。该修补程序要求   映射托管S3文件看   好像它们被从服务   你自己的域名 - 虚拟主机。该   最简单,最有吸引力的方法   将是像一个托管文件的URL   这样的:

http://s3.amazonaws.com/your-bucket/some-file.txt If you plan on using S3 to host media files - more specifically Flash files - you’ll run into Adobe’s cross domain security policy. The fix requires mapping your hosted S3 files to look as though they are being served from your own domain - virtual hosting. The easiest and most attractive method would be a hosted file URL that like this:

http://s3.your-site.com/some-file.txt   要开始,创建S3桶   要用作根您   托管文件。对于这个例子,您的   S3存储是:

http://s3.your-site.com/some-file.txt To get started, create a bucket on S3 that you want as the root for your hosted files. For this example, your S3 bucket would be:

s3.your-site.com最重要的   步骤添加适当的CNAME   记录你的DNS设置。

s3.your-site.com The most important step is adding the appropriate CNAME record to your DNS settings.

名称类型数据   s3.your-site.com CNAME s3.amazonaws.com。   期待你新的DNS设置取   长达24-48小时解决。

Name Type Data s3.your-site.com CNAME s3.amazonaws.com. Expect your new DNS settings to take up to 24-48 hours to resolve.

这篇关于Amazon S3的URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆