4 ms·
> ... find their approach much more flexible vs lambda@edge being possibly triggered four times at edge part of a request life cycle. The lamda@edge function i
by helsinkiandrew 6y ago
> ... find their approach much more flexible vs lambda@edge being possibly triggered four times at edge part of a request life cycle.
The lamda@edge function is executed only once but you decide when - before or after the cache and either on the request or response.
- nhoughto 6y agoSo if I want to hook into each 4 parts of the lifecycle, I configure that and it gets executed once? Can I maintain state between inbound request->origin request->origin response->inbound response? My understanding was you can’t and it got called 4 times with different events, workers solves this by you being responsible for making the origin request (there is a simple mode where it does it for you to) with promises to manage origin response and inbound response logic.. I thought lambda@edge didn’t work like that?
- helsinkiandrew 6y agoFor each lambda function you specify which one of the 4 places it is called. So effectively be 4 different lambda functions, triggered independently (they could ofcourse share code). If you wanted to maintain state then I'd guess the easiest (only?) way is for the function to add headers to the HTTP request/response as it passed through.