https://github.com/clearcodehq/cookie-sync-lambda
Example implementation of cookie syncing using AWS Lambda@Edge
https://github.com/clearcodehq/cookie-sync-lambda
Last synced: 11 months ago
JSON representation
Example implementation of cookie syncing using AWS Lambda@Edge
- Host: GitHub
- URL: https://github.com/clearcodehq/cookie-sync-lambda
- Owner: ClearcodeHQ
- License: gpl-3.0
- Created: 2017-08-30T08:40:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-27T12:53:01.000Z (over 7 years ago)
- Last Synced: 2025-05-07T19:35:55.084Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lambda Edge Cookie Sync
A proof of concept of using AWS Lambda Edge for redirect logic of cookie syncing endpoint.
Created for a AWS blog post available here https://aws.amazon.com/blogs/networking-and-content-delivery/leveraging-lambda-at-edge-for-adtech-cookie-syncing-at-the-edge/
## Running locally
* Install Node.js 6
* Install dependencies `npm install .`
Test with different event contents
./node_modules/.bin/lambda-local -f index.js -e event.json
./node_modules/.bin/lambda-local -f index.js -e event_nocookie.json
## Running in AWS
Set up Lambda function and CloudFront following the instructions in the blog post.
Use the console snippets or your browser for tests.
Default response
curl -v 'https://[DISTRIBUTION_ADDRESS]/pixel.gif';
Creating new cookie identifier when no cookie is present
curl -v 'https://[DISTRIBUTION_ADDRESS]/getuid/https://id.dmp.com/dsp_uid/$UID';
Extending lifespan of existing cookie
curl -v 'https://[DISTRIBUTION_ADDRESS]/getuid/https://id.dmp.com/dsp_uid/$UID' \
-H 'Cookie: dsp_uid=93fcefd8-d5ea-40e8-9eb1-dca37e850cc5;';
Author: Z. Hartleb