Validate CloudFront Functions event structures for viewer request and response.
Last verified: May 2026
Validate CloudFront Functions event structures for viewer request and response.
Required Fields
eventTypeeventevent.versionOutput will appear here...The CloudFront Function Tester provides an environment for writing and testing CloudFront Functions code directly in your browser. CloudFront Functions run at the edge for viewer-facing request and response manipulation, and testing them locally before deployment prevents edge errors that are difficult to debug. This tool lets you write function code, define test events with custom headers, query strings, and URIs, and see the output immediately.
CloudFront Functions run at all 400+ edge locations, execute in under 1 millisecond, and support only viewer request/response events with a JavaScript runtime. Lambda@Edge runs at regional edge caches, supports all four event types including origin events, allows Node.js or Python, and has higher memory and execution time limits.
No. This tool provides a browser-based testing environment. Once your function works correctly, you deploy it through the CloudFront console, CLI, or infrastructure-as-code tools.
Your team is implementing URL canonicalization at the edge: redirect /products to /products/, strip trailing slashes from /products/, etc. Writing this as a CloudFront Function in the AWS Console means deploying-then-testing-then-fixing in 5-minute deployment cycles. With the tester, you write the function locally, paste 20 different URL patterns as test events, and iterate the logic in seconds. By the time you deploy to CloudFront, the function passes every test on the first try.
The tester runs your CloudFront Function code in a JavaScript sandbox that emulates the CloudFront runtime: synchronous-only execution, restricted globals (no fetch, no setTimeout), and the canonical request/response event shape. You provide a test event with URL, query string, and headers, and the tester runs your function and shows the modified event output side-by-side with the input.
CloudFront Functions are limited to 10 KB of code, 2 MB of memory, and 1 ms of execution time. They can NOT make network calls. If your function needs to call out to anything (auth backend, dynamic config), you need Lambda@Edge instead. CloudFront Functions are for pure transformation: rewrite URLs, set headers, normalize query strings.
The function input event has both `request` (for viewer-request and origin-request) and `response` (for viewer-response and origin-response) — but you only get one event type per function. Plan carefully: viewer-request rewrites the request before cache lookup; viewer-response modifies the response after cache. Wrong event type = no effect.
Test with realistic request data including headers, query strings, and cookies. CloudFront Functions silently truncates header values >1 KB — a function that works fine with test data may fail in production with real cookie payloads. Always test with copies of actual production request headers.
Was this tool helpful?
Disclaimer: This tool runs entirely in your browser. No data is sent to our servers. Always verify outputs before using them in production. AWS, Azure, and GCP are trademarks of their respective owners.