Wrap JPEG image in a multipart header using AWS Lambda@Edge

Viewed 160

I have been trying to read the AWS Lambda@Edge documentation, but I still cannot figure out if the following option is possible.

Assume I have an object (image.jpg, with size 32922 bytes) and I have setup AWS as static website. So I can retrieve:

$ GET http://example.com/image.jpg

I would like to be able to also expose:

$ GET http://example.com/image

Where the response body would be a multipart/related file (for example). Something like this :

--myboundary
Content-Type: image/jpeg;
Content-Length: 32922
MIME-Version: 1.0

<actual binary jpeg data from 'image.jpg'>
--myboundary

Is this something supported out of the box in the AWS Lambda@Edge API ? or should I use another solution to create such response ? In particular it seems that the response only deal with text or base64 (I would need binary in my case).

1 Answers
Related