/Latest
folder to the /12.50
folder.Result: the redirect kicks in, but moves the user from the cloudfront URL to the endpoint URL.
e.g. A user who comes in at <mysite>.cloudfront.net/Latest
gets redirected to <bucket>.hpe-alm.s3-website-us-west-2.amazonaws.com/12.50
.
Question: is there a way for the redirect to keep the user on the cloudfront domain?
Rather than performing the redirect within Amazon S3, you could change the origin path within CloudFront.
/12.50
Here's some examples:
Full redirect
In this case, I re-pointed the root (dxxx.cloudfront.net
) to a sub-directory:
v1
and v2
v1
and v2
respectivelyv1
origindxxx.cloudfront.net/picture.jpg
. It returned the picture from v1
.v2
origin. Once the distribution was ready, I accessed the same URL and it returned the picture from v2
.Redirect of a sub-directory
In this example, I re-pointed dxxx.cloudfront.net/Latest
to a different sub-directory.
The important difference is that the destination subdirectory has to contain a /Latest
subdirectory, since it is actually pointing to dxxx.cloudfront.net/<version>/Latest
, with only the <version>
portion being substituted.
/Latest
folder within the v1
and v2
subdirectories and put pictures in each of them/Latest/*
pointing to the v1
origindxxx.cloudfront.net/Latest/picture.jpg
. It returned the picture from /Latest/v1
./Latest
behaviour to point to the v2
origin. Once the distribution was ready, I accessed the same URL and it returned the picture from /Latest/v2
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With