【问题标题】:Images from amazon s3 are not visible in meteor template来自亚马逊 s3 的图像在流星模板中不可见
【发布时间】:2015-06-15 21:29:57
【问题描述】:

有人告诉我为什么我的流星模板中看不到来自 s3 的图像吗? 如果我在浏览器中输入图像 url,它会显示该图像,但不在我的模板中。 这是我的模板代码:

<template name="test">
  <div>
    <img src="http://mybucket.s3.amazonaws.com/images/1_p.jpg " />
  </div>        
  ...  
</template>

接下来的错误是:

拒绝加载图像“http://mybucket.s3.amazonaws.com/images/1_p.jpg”,因为它违反了以下内容安全政策指令:“img-src data: 'self' http://.googleapis.com https://.googleapis.com http://.gstatic.com https://.gstatic.com http://.bootstrapcdn.com https://.bootstrapcdn。 com”。

test:1 Uncaught SyntaxError: Unexpected token Y

【问题讨论】:

  • 您是否尝试过从网络加载其他图像并且它们是否有效?如果其他图像不起作用,则与您的代码有关。如果其他图像确实有效,那么这与您的 s3 设置有关。
  • 我刚刚在 chrome 中尝试过,它给出了 CSP 错误。
  • 你能告诉我们错误信息和你的代码吗?
  • 我已经更新了问题。

标签: meteor amazon-s3


【解决方案1】:

谢谢各位。我解决了这个问题。实际上我正在使用浏览器策略包,为了访问 s3 上的数据,我需要在白名单中添加 s3 url..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-07
    • 1970-01-01
    • 2014-02-22
    • 2017-08-01
    • 2012-10-11
    • 2015-02-19
    • 1970-01-01
    相关资源
    最近更新 更多