UNPKG

@webscale-networks/cloudedge-handlers

Version:

Webscale Networks CloudEDGE Handlers for cloud-agnostic edge function execution

203 lines (202 loc) 8.04 kB
exports.events = { compute: { "request": { "method": "GET", "peerAddress": "1.1.1.1", "query": "?page=12", "path": "/path", "host": "www.example.com", "protocol": "https", "requestId": "abc123", "wsapp": "app_id", "headers": { "host": ["www.test.com"], "cookie": ["c1", "c2"], "accept": ["image/webp,image/svg+xml,image/*,*/*;q=0.8"] } }, "response": { "status": "200", "headers": {}, "body": "Hello world", "bodyEncoding": "text" }, }, handleRequest: { "Records": [{ "cf": { "config": { "distributionDomainName": "d111111abcdef8.cloudfront.net", "distributionId": "EDFDVBD6EXAMPLE", "eventType": "origin-request", "requestId": "4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ==" }, "request": { "body": { "inputTruncated": false, "encoding": "base64", "data": "", }, "clientIp": "203.0.113.178", "headers": { "x-forwarded-for": [{ "key": "x-forwarded-for", "value": "203.0.113.178" }], "user-agent": [{ "key": "user-agent", "value": "Amazon CloudFront" }], "via": [{ "key": "via", "value": "2.0 2afae0d44e2540f472c0635ab62c232b.cloudfront.net (CloudFront)" }], "host": [{ "key": "host", "value": "example.org" }], "cache-control": [{ "key": "cache-control", "value": "no-cache, cf-no-cache" }], "content-length": [{ "key": "content-length", "value": "3334", }], }, "method": "GET", "origin": { "custom": { "authMethod": "none", "customHeaders": {}, "domainName": "example.org", "keepaliveTimeout": 5, "path": "", "port": 443, "protocol": "https", "readTimeout": 30, "region": "", "sslProtocols": [ "TLSv1", "TLSv1.1", "TLSv1.2" ] } }, "querystring": "", "uri": "/" } } }] }, handleResponse: { "Records": [{ "cf": { "config": { "distributionDomainName": "d111111abcdef8.cloudfront.net", "distributionId": "EDFDVBD6EXAMPLE", "eventType": "origin-response", "requestId": "4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ==" }, "request": { "clientIp": "203.0.113.178", "headers": { "x-forwarded-for": [{ "key": "x-forwarded-for", "value": "203.0.113.178" }], "user-agent": [{ "key": "user-agent", "value": "Amazon CloudFront" }], "via": [{ "key": "via", "value": "2.0 8f22423015641505b8c857a37450d6c0.cloudfront.net (CloudFront)" }], "host": [{ "key": "host", "value": "example.org" }], "cache-control": [{ "key": "cache-control", "value": "no-cache, cf-no-cache" }] }, "method": "GET", "origin": { "custom": { "customHeaders": {}, "domainName": "example.org", "keepaliveTimeout": 5, "path": "", "port": 443, "protocol": "https", "readTimeout": 30, "sslProtocols": [ "TLSv1", "TLSv1.1", "TLSv1.2" ] } }, "querystring": "", "uri": "/" }, "response": { "headers": { "access-control-allow-credentials": [{ "key": "access-control-allow-credentials", "value": "true" }], "access-control-allow-origin": [{ "key": "access-control-allow-origin", "value": "*" }], "date": [{ "key": "date", "value": "Mon, 13 Jan 2020 20:12:38 GMT" }], "referrer-policy": [{ "key": "referrer-policy", "value": "no-referrer-when-downgrade" }], "server": [{ "key": "server", "value": "ExampleCustomOriginServer" }], "x-content-type-options": [{ "key": "x-content-type-options", "value": "nosniff" }], "x-frame-options": [{ "key": "x-frame-options", "value": "DENY" }], "x-xss-protection": [{ "key": "x-xss-protection", "value": "1; mode=block" }], "content-type": [{ "key": "content-type", "value": "text/html; charset=utf-8" }], "content-length": [{ "key": "content-length", "value": "9593" }], "transfer-encoding": [{ "key": "Transfer-Encoding", "value": "chunked" }], "via": [{ "key": "via", "value": "2.0 2afae0d44e2540f472c0635ab62c232b.cloudfront.net (CloudFront)" }] }, "status": "200", "statusDescription": "OK" } } }] }, };