Hi
I have the following as my CloudFront Function:
function handler(event) {
console.log(event);
return event.request;
}
In the CloudFront console, I switch to the Test tab, and use this as URL path: /1234?param=1
. When I run the test request and inspect the logs, I see the following:
{
"version":"1.0",
"context":{
"distributionDomainName":"[redacted].cloudfront.net",
"distributionId":"[redacted]",
"eventType":"viewer-request",
"requestId":"4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ=="
},
"viewer":{
"ip":"1.2.3.4"
},
"request":{
"method":"GET",
"uri":"/index.html?q:1",
"querystring":{
},
"headers":{
},
"cookies":{
}
}
}
In the Test tab GUI, if I add the params to "Query string" section, it works fine. But when I execute the request from different clients, say a browser, the query params are actually part of the event.request.uri
instead of event.request.querystring
.
We're expecting the params to be part of the querystring object, is this not true? Is there some sort of configurations to parse these correctly?
I have added the following screen grabs if it would help: