因此,我设置了回形针以与S3配合使用,以在上传时存储图像。很好。
然后,我去添加Cloudfront资产(使用下面的代码)
config.action_controller.asset_host = ENV['CLOUDFRONT_ENDPOINT']
并构建资产,似乎可以正确构建所有内容,但是每当我转到页面时,链接就在那里
<link rel="stylesheet" media="all" href="http://d2j2dcfn0tfw0d.cloudfront.net/assets/application-ef64d41d2d57abb59ffe5bd71a4f727580ef276a6440e70210cf8d0ab22a6dc2.css" />
<script src="http://d2j2dcfn0tfw0d.cloudfront.net/assets/application-8cd15647254a9c6f940c58bcae0567e6ca66943b8a7576ce87ec903bd19f9937.js"></script>
但是当我转到该链接时,出现此XML错误
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>
assets/application-ef64d41d2d57abb59ffe5bd71a4f727580ef276a6440e70210cf8d0ab22a6dc2.css
</Key>
<RequestId>374DF77BF548DE75</RequestId>
<HostId>
TqrV7id3elsBjugWNkUObG259mU6Vk8MhxcXjrre1qv+XvxGBERDjWoW50iiCyp4
</HostId>
</Error>
我看着我的s3盒子,它也不在那里。
我的所有cloudfront设置都是默认设置,除了我的原点是我的s3框
为了使Cloudfront从s3获取资产,您需要将资产复制到s3。asset_sync
gen的一个流行选择是将它作为部署的一部分来执行。
另一个选择是让Cloudfront从您的服务器中获取资产-这需要向Cloudfront发行中添加新的来源和行为。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句