AWS CloudFront 重定向到 S3 存储桶 [英] AWS CloudFront redirecting to S3 bucket

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

问题描述

我创建了一个 CloudFront 分配来为静态网站提供服务.S3 是原始服务器.现在,如果我们访问 CloudFront URL,它会重定向到 S3 位置.

d2s18t7gwlicql.cloudfront.net或者test.telekha.in

在浏览器中显示https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/dashboard

我期待 https://test.telekha.in/#/dashboard

如果我通过 curl 访问 https://test.telekha.in,它会返回我的 索引.html 文档

如果我通过 curl 访问 http://test.telekha.in 它返回

<head><title>301 永久移动</title></head><body bgcolor=白色"><center><h1>301 永久移动</h1></center><hr><center>CloudFront</center>

但在浏览器中,HTTP 和 HTTPS 都重定向到 https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/

请告诉我如何解决此问题.

解决方案

我发现了这个问题.它具有云前端配置.这个 博客帮助了我.

在定义原点时,我直接选择了 S3 存储桶.我们应该像telekha-test-www.s3-website.ap-south-1.amazonaws.com一样输入S3存储桶的域

I have created a CloudFront distribution to serve the static website. S3 is origin server. Now if we access CloudFront URL, it redirects to S3 location.

d2s18t7gwlicql.cloudfront.net or test.telekha.in

In the browser it is showing https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/dashboard

I am expecting https://test.telekha.in/#/dashboard

If I access https://test.telekha.in through curl it returns my index.html document

If I access http://test.telekha.in through curl it returns

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>

But in browser both HTTP and HTTPS are redirecting to https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/

Please let me know how to resolve this issue.

解决方案

I found the issue. It is with cloudfront configuration. This blog helped me.

While defining the origin I have directly selected S3 bucket. We should enter the domain of the S3 bucket like telekha-test-www.s3-website.ap-south-1.amazonaws.com

这篇关于AWS CloudFront 重定向到 S3 存储桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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