【问题标题】:Cant host bootstrap and glyphicons on Amazon S3. Cross-Origin Request Blocked.无法在 Amazon S3 上托管引导程序和字形图标。跨域请求被阻止。
【发布时间】:2026-01-25 03:40:01
【问题描述】:

我在 Amazon S3 上有一个存储桶。在桶里我有这个:

assets/css/bootstrap.css

assets/fonts/glyphicons-halflings-regular.woff2

assets/fonts/glyphicons-halflings-regular.woff

assets/fonts/glyphicons-halflings-regular.ttf

正如引导程序documentation 所建议的那样。但是我在我的网站上看不到字形图标,而是在控制台上收到此错误:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://bootstrapvitality.s3.amazonaws.com/assets/fonts/glyphicons-halflings-regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:3): bad URI or cross-site access not allowed source: https://bootstrapvitality.s3.amazonaws.com/assets/fonts/glyphicons-halflings-regular.ttf

对于每个 glyphicon 文件。 我该如何解决这个问题?

【问题讨论】:

标签: amazon-s3 cors


【解决方案1】:

我推荐你使用 Bootstrap CDN。

http://getbootstrap.com/getting-started/

祝你好运

【讨论】:

    【解决方案2】:

    将此添加到权限/编辑 CORS 配置解决了它:

    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
    </CORSRule>
    

    【讨论】:

      最近更新 更多