https://github.com/tengattack/lambda
lambda edge scripts for Amazon CloudFront
https://github.com/tengattack/lambda
Last synced: about 1 year ago
JSON representation
lambda edge scripts for Amazon CloudFront
- Host: GitHub
- URL: https://github.com/tengattack/lambda
- Owner: tengattack
- Created: 2020-02-25T12:53:54.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-01T23:40:00.000Z (about 4 years ago)
- Last Synced: 2025-02-10T02:21:40.693Z (over 1 year ago)
- Language: JavaScript
- Size: 270 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lambda
Amazon CloudFront Edge Scripts
## viewer-request
Transform URL `/?lambda=style/` to `/lambda!<style>/<path>` in viewer request function.
BTW, Invalidation path should be transformed URLs, like `/lambda!webp/*`.
## origin-response
Parse the URL with `/lambda!<style>/` prefix and convert source image to specified style image (save to Amazon S3 for future access directly).
### Style
- `avatar` (180x180, webp format)
- `avatar_jpg` (180x180, jpeg format)
- `webp` (webp format)
### MozJPEG support
Build mozjpeg on CentOS 7:
```sh
scl enable devtoolset-7 bash
cd /path/to/build
git clone https://github.com/mozilla/mozjpeg.git
cd mozjpeg
cmake -DPNG_SUPPORTED=0 -DWITH_JPEG8=1 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib64 .
make
# copy library
cp libjpeg.so.8.2.2 /path/to/lambda/lib/
```