I created a lambda function with a API gateway and Cloudfront distribution in the front
in the cloudfront behaviors I disabled caching
this is the lambda function:
exports.handler = async (event) => {
const response = {
statusCode: 200,
body: JSON.stringify('rawQueryString is: ' + event.rawQueryString),
};
return response;
};
calling the api gateway I see the querystring in the lambda response https://xxx.execute-api.us-east-1.amazonaws.com/api?name=john
rawQueryString is: '?name=john'
calling the cloudfront distribution i can't see the querystring in the lambda response https://xxx.cloudfront.net/api?name=john
rawQueryString is: ''
I tried with "Origin Request Policy"
but now when i call https://xxx.cloudfront.net/api?name=john
I get
{
"message": "Forbidden"
}