Amazon S3 未正确提供文件 [英] Amazon S3 is not serving files correctly

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

问题描述

我为我的朋友制作了这个网站,并将其上传到 Amazon S3 存储桶 (http://ballard26.s3.amazonaws.com/index.html),当我访问该站点时,页面无法正确加载,我不知道为什么.有什么想法吗?

I made this site for my friend and I uploaded it to an Amazon S3 bucket (http://ballard26.s3.amazonaws.com/index.html) and when I go to that site the page doesn't load correctly and I have no idea why. Any ideas?

例如,stylesheet.css 没有正确加载.如果您访问 http://ballard26.s3.amazonaws.com/stylesheet.css,它会下载文件而不是将其加载为 CSS.

For example, the stylesheet.css doesn't load correctly. If you go to http://ballard26.s3.amazonaws.com/stylesheet.css, it downloads the file instead of loading it as CSS.

推荐答案

检查您上传的文件的 MIME 类型(HTTP 内容类型标头).S3 并不总是正确设置它们.您可能需要在上传 API 调用中设置它们.一些上传库会为您执行此操作.

Check the mime types (HTTP content type header) on the files you uploaded. S3 does not always set them correctly. You may need to set them on the upload API call. Some upload libraries will do this for you.

如果从浏览器从 S3 下载文件时 mime 类型不正确,如果 mime 类型设置不正确,则它不会总是正确呈现.

If the mime types are not correct when the file is downloaded from the browser from S3 if the mime type is not set correctly it will not always render correctly.

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

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