问题描述
- 我已经与Backbone.js的单页的应用程序。
- 在我主持的应用程序(应用程序只包括静态文件)在Amazon S3。
- 在我使用CloudFront的如斗CDN。
- 应用是由
https://myapp.com访问 - > https://abcdefgh34545.cloudfront.com - > https://myBucket.s3-eu-west-1.amazonaws.com/index.html
- I have single page app built with Backbone.js.
- I host app (app consists of static files only) on Amazon S3.
- I use CloudFront as a Bucket CDN.
- App is accessed by
https://myapp.com -> https://abcdefgh34545.cloudfront.com -> https://myBucket.s3-eu-west-1.amazonaws.com/index.html
我如何使用 prerender.io
服务,这个堆栈?我必须以某种方式检测WebSpider / WebRobot正在访问的页面,重定向到prerender.io ...
How I can use Prerender.io
service with this stack? I have to somehow detect that WebSpider/WebRobot is accessing the page and redirect it to prerender.io...
推荐答案
这是很难用prerender.io一个静态Amazon S3的网站。
It's hard to use Prerender.io with a static Amazon S3 site.
您可以站起来的nginx的/ Apache服务器在S3的面前: https://myapp.com
- > https://开头mynginx -server.com
- > https://myBucket.s3-eu-west-1.amazonaws.com/index.html
You could stand up an nginx/apache server in front of s3: https://myapp.com
-> https://mynginx-server.com
-> https://myBucket.s3-eu-west-1.amazonaws.com/index.html
因为你失去CloudFront的最接近的定位好处此解决方案不够理想。
This solution is less ideal because you lose the closest-location benefit of cloudfront.
这是有关自定义解决方案的好文章: HTTP: //www.dave.cx/post/23/$p$prendering-angular-s3/
This is a good article about a custom solution: http://www.dave.cx/post/23/prerendering-angular-s3/
大卫是能够生成静态HTML,并将其保存在S3中,然后使用CloudFlare的检测_escaped_fragment_的URL,并将其重定向到S3的静态HTML。
David was able to generate the static HTML and save them in S3, then use CloudFlare to detect _escaped_fragment_ in the URL and redirect it to the static HTML on S3.
这篇关于单页应用程序+亚马逊S3 +亚马逊CloudFront的+ prerender.io - 如何设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!