News for hackers. Stuff that matters.
Re:Lambda@Edge – Preview by hackcrafter on Thursday December 01, 2016 @02:08PM (#13082412)
> Because your JavaScript code will be part of the request/response path, it must be lean, mean, and self-contained. It cannot make calls to other web services and it cannot access other AWS resources. It must run within 128 MB of memory, and complete within 50 ms.

I'm having a hard time conceptualizing what kind of logic you would run on these edge functions?

You have access to headers, so also things like client cookies, so could you use that to potentially personalize/templatize the body (once they have body mutation abilities)?

Or is it really just about static content routing? Detect google bot user agent and send them to resource A versus B etc...

Re:Lambda@Edge – Preview by Alex3917 on Thursday December 01, 2016 @02:36PM (#13082670)
> I'm having a hard time conceptualizing what kind of logic you would run on these edge functions?

Two use cases:

1) Routing Facebook and Twitter to a pre-rendered version of your single page app based on their user agents.

2) Adding custom headers to your responses, e.g. for a Content Security Policy.

There is no good way to do either of those things currently. You could have one off options for each of those and the 50 other common use cases, but this is actually a really elegant solution. Very well done.

Re:Lambda@Edge – Preview by jensvdh on Thursday December 01, 2016 @06:24PM (#13084587)
Would you be able to route facebook/google to a pre-rendered version of your app without sending it a 301 redirect though?
Re:Lambda@Edge – Preview by jalk on Thursday December 01, 2016 @04:12PM (#13083544)
This is totally cool if the origin is just a dumb S3 bucket. From what I can tell, you can implement the same kind of rewrite logic you would otherwise have in i.e. httpd/nginx conf.

And of course doing so at the edge means that you potentially shave off some latency during redirects.

Re:Lambda@Edge – Preview by wiredfool on Thursday December 01, 2016 @04:12PM (#13083550)
It's a potentially cleaner way to send back a redirect from API gateway/lambda rather than pattern matching on http in the error string of the Jason response body.
Re:Lambda@Edge – Preview by ash_gti on Thursday December 01, 2016 @02:10PM (#13082428)
Couldn't you have your apps primary routing handling in this?
Re:Lambda@Edge – Preview by mifreewil on Thursday December 01, 2016 @02:23PM (#13082544)
The linked post uses CloudFront as an example, which is commonly used simply as a CDN in front of static content on S3. This allows you to take that model and add some dynamic content to it.

I just recently used this model to host a JS widget used on external websites, now I could for example add some basic logic to disallow certain domains (by checking referrer headers) from using the widget.

Re:Lambda@Edge – Preview by forrestbrazeal on Thursday December 01, 2016 @02:11PM (#13082433)
The blog post says that one of the primary use cases is to help preview content show up correctly on Facebook, etc. So I don't think client-side routing for static apps will work in this case.