lundi 7 avril 2014

Amazon S3 Redirect et Cloudfront - débordement de pile


I'm trying to setup 301 redirects on S3 using objects, referenced here http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html. I've been having some problems and can't seem to figure out what I'm doing wrong.


What I get is a blank page (0 byte file) as if the 'Website Redirect Location' metadata value is not set.


What am I doing wrong?


Also, does this work on AWS CloudFront?




My S3 Console Setup S3 Console Setup


Couple things to note:


I have this setup for hosting a static site. I'm using ssl/https with my own cert uploaded and set on the cloudfront distribution. All the pages seem to work except the redirecting objects. I've tried setting up routing rules but they didn't seem to work in Cloudfront.


I'm trying to access the redirects both through the cloudfront url and the s3 url (https://s3.amazonaws.com/{bucket}/users/sign_in)




For web site-like functionality in S3, such as redirects, html error messages, and index documents, you can't use the REST endpoint (e.g. s3.amazonaws.com) since these features are only provided by the web site endpoints (e.g. bucketname.s3-website-us-east-1.amazonaws.com).


http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html


To make the behavior available in Cloudfront, you need to configure Cloudfront to use this endpoint, as well, not the REST one offered via autocomplete in the console. Note that the web emdpoints do not support HTTPS, but you can configure Cloudfront to fetch from the bucket with HTTP even though the client connection is HTTPS.



I'm trying to setup 301 redirects on S3 using objects, referenced here http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html. I've been having some problems and can't seem to figure out what I'm doing wrong.


What I get is a blank page (0 byte file) as if the 'Website Redirect Location' metadata value is not set.


What am I doing wrong?


Also, does this work on AWS CloudFront?




My S3 Console Setup S3 Console Setup


Couple things to note:


I have this setup for hosting a static site. I'm using ssl/https with my own cert uploaded and set on the cloudfront distribution. All the pages seem to work except the redirecting objects. I've tried setting up routing rules but they didn't seem to work in Cloudfront.


I'm trying to access the redirects both through the cloudfront url and the s3 url (https://s3.amazonaws.com/{bucket}/users/sign_in)



For web site-like functionality in S3, such as redirects, html error messages, and index documents, you can't use the REST endpoint (e.g. s3.amazonaws.com) since these features are only provided by the web site endpoints (e.g. bucketname.s3-website-us-east-1.amazonaws.com).


http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html


To make the behavior available in Cloudfront, you need to configure Cloudfront to use this endpoint, as well, not the REST one offered via autocomplete in the console. Note that the web emdpoints do not support HTTPS, but you can configure Cloudfront to fetch from the bucket with HTTP even though the client connection is HTTPS.


0 commentaires:

Enregistrer un commentaire