Tag: amazon cloudfront

与Amazon S3和Cloudfront的CORS

我在Heroku上托管了一个Rails应用程序,它使用CloudFront和S3上托管的资产。 它完美地显示资产(虽然它需要一些摔跤)。 我对Cloudfront的设置: Forward Headers: Whitelist Whitelist Headers: Origin Forward Query Strings: No S3存储桶的CORS设置: * GET HEAD * 调用图像的JS(咖啡) @mousemove (e) -> ctx = $(“”).attr( width: @width height: @height )[0].getContext(“2d”) ctx.drawImage(this, 0, 0, @width, @height) # This is because firefox doesn’t support offset[X|Y] if(e.offsetX == undefined) xpos = e.pageX – $(this).offset().left; ypos = e.pageY – […]

Rails asset_host,cloudfront和heroku

我正在heroku上运行一个rails 4.0应用程序,对于我的生活,我无法使用我在asset_host中设置的主机获取我的资产URL。 我相信我的云端设置很好,因为我可以在我的cloudfronturl中替换我的任何资产url,并且该文件是从heroku中获取并缓存在cloudfront上的。 所以https://xxxxxxxxxxxx.cloudfront.net/assets/application-xxxxxxxx.js正确缓存https://myapp.com/assets/application-xxxxxxxxx.js 。 问题似乎是我的资产助手,例如javascript_include_tag,永远不会在staging.rb中使用asset_host设置。 我加载页面时看到的是我所有的js和css文件都来自https://myapp.com/assets/ 我的分段设置如下所示: # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_controller.perform_caching = true # Disable Rails’s static asset server (Apache or nginx will already do this) config.serve_static_assets = true # Compress JavaScripts and CSS config.assets.compress = true # Don’t fallback to assets pipeline […]

Firefox不会从CloudFront渲染字体

我有一个Rails应用程序,托管在Heroku上 。 在部署期间,资产通过asset_sync gem与Amazon S3存储桶同步,并且视图通过CloudFront调用这些资产。 但是,使用Firefox查看网站时不会呈现字体(文件在Firebug的“网络”选项卡中加载,但根本不使用)。 Safari很棒。 我在S3上有以下CORS配置: * GET 3000 Content-* Host 我的应用程序还设置了以下标题: Access-Control-Allow-Origin: * Access-Control-Request-Method: * 但CloudFront返回没有它们的字体…为什么没有加载字体? 提前致谢。

Cloudfront CORS问题在Rails应用程序上提供字体

访问我的网站时,我一直收到来自控制台的错误消息: font from origin ‘https://xxx.cloudfront.net’ has been blocked from loading by Cross-Origin Resource Sharing policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://www.example.com’ is therefore not allowed access. 我尝试了一切: 我已经安装了font_assets gem 配置了application.rb文件 config.font_assets.origin = ‘http://example.com’ Cloudfront上的白名单标题,如本文所述 Access-Control-Allow-Origin Access-Control-Allow-Methods Access-Control-Allow-Headers Access-Control-Max-Age 但没有,零,虚无… 我在Heroku上使用Rails 4.1。

Heroku + Rails4.2:Cloudfront设置

我正在尝试为我的heroku应用程序设置Cloudfront。 文件似乎缺乏独立的立场。 以下是我遵循的步骤: 1. Setup Cloudfront in AWS console 2. Added cloudfront domain name to production.rb `config.action_controller.asset_host = ‘XXXX.cloudfront.net’` 3. Set `config.assets.compile = true` in production.rb 4. Verified AWS_SECRET_ACCESS_KEY is correct in heroku config 5. I have added `gem ‘rails_12factor’, group: :production` 资产不再加载。 我在设置中缺少的任何步骤? UPDATE1: 在chrome调试器中,从此URL的cloudfront正确请求资产: http : //XXXXX.cloudfront.net/assets/application-22c7c249df1a24541d86603b0715eefe.css 但是在请求标题中,请参阅Status Code:302 Moved Temporarily 。 我想知道我是否有重定向循环以及如何调试它。 […]

Rails Passenger Glyphicon CORS Cloudfront NGINX问题

所以我知道stackoverflow是关于CORS Nginx,Cloudfront和Heroku的这些问题,但由于某种原因,我无法让它工作。 我一直在关注这个问题的答案: 如何使用rails,nginx和passenger配置`Access-Control-Allow-Origin`? 但是,我似乎无法弄清楚自定义代码块的放置位置: config/nginx.conf.erb 接下来,通过查找如下所示的块来编辑配置文件config / nginx.conf.erb: location @static_asset { gzip_static on; expires max; add_header Cache-Control public; add_header ETag “”; } …and add the two Access-Control lines: 至 > location @static_asset { > gzip_static on; > expires max; > add_header Cache-Control public; > add_header ETag “”; > add_header Access-Control-Allow-Origin *; > add_header Access-Control-Request-Method […]

在S3和cloudfront上运行carrierwave私有文件

我有来自亚马逊云端服务器的公共和私有文件,公共文件工作正常,但现在我想通过经过身份validation的读取来保护其中一些是私有的。 私有文件有自己的Uploader DocumentUploader,文件需要存储在不同的存储桶中吗? 就像现在一样,他们都在一个桶里。 我曾经用Paperclip做过类似的事情,但似乎找不到使用Carrierwave和使用定时Authenticated_url来做这件事的好资源 我看到他们在这里有类似的东西: http://www.rdoc.info/github/jnicklas/carrierwave/5d1cb7e6a4e8a4786c2b/CarrierWave/Storage/Fog/File#authenticated_url-instance_method 但我不确定如何实现它。 任何提示将非常感谢。

Rails 3自动资产部署到Amazon CloudFront?

Rails 3.1中是否有可用的gem或方法可以自动将资产上传到亚马逊云端并使用这些资源而不是本地托管的资源? 我想手动上传编译资产然后更改rails app config以使用该资产主机很容易,但是当修改资产时,需要再次手动上传到云端。 有什么好办法吗?