0

I have a working Lambda@edge on the Client Response. I have a little data I need to get to the client.

The response body cannot be modified, and I want to see if it is possible to get this data back another way without having to do a custom response creation in a Client Request lambda. This information will be consumed by an existing javascript function in the returned response. That javascript function I can modify if needed.

Headers in the response cannot be read by the javascript on that page, so that much is flat out. The server processing and response is too heavy (legacy app, very ugh), and so I would not be comfortable creating a second, asynchronous request on the page just to try to gleam those headers.

Is there anything in the Client Response lambda's response object that can both be set on the response and ready by the page?

Randy Hall
  • 7,716
  • 16
  • 73
  • 151

1 Answers1

0

Some data can be passed back using the set-cookie header. However, this is very limited in scope (4kb total for all of a domain's cookies) and so has very limited practical application.

exports.handler = (event, context, callback) => {
    var response = event.Records[0].cf.response;
    response.headers['set-cookie'] = "some cookie string";
    callback(null, response);
};
Randy Hall
  • 7,716
  • 16
  • 73
  • 151