aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
449 stars 113 forks source link

Amplify Access logs always show no Cookies #3948

Open shivennn opened 2 months ago

shivennn commented 2 months ago

Before opening, please confirm:

Amplify Hosting feature

Access logs, Custom headers

Is your feature request related to a problem? Please describe:

I am using Amplify hosting with custom domain and flow of request is as under.

Custom Cloud Front Distribution ----> Amplify App Origin

In Lambda Edge Function logs I observed cookies values passed from my custom Cloud Front Distribution but in Amplify Access logs of domain shows no cookies.

export const handler = (event, context, callback) => {
console.log("function invoked");
const request = event.Records[0].cf.request;
const uri = request.uri;
console.log(uri);
// Log the Cookie header
const headers = request.headers;
if (headers.cookie) {
    const cookies = headers.cookie.map(header => header.value).join('; ');
    console.log("Cookies: ", cookies);
} else {
    console.log("No Cookie header found");
}

console.log(request.uri);
return callback(null, request);
};

As discussed with AWS support team members Amplify managed Cloud Front Distribution has below settings which preventing cookie logging in Access Logs.

Headers : Accept , CloudFront-Viewer-Country , Host
Cookie logging : Off

workaround :

Describe how you'd like this feature to work

Provide Support for cookie logging in Amplify managed Cloud Front Distribution.

github-actions[bot] commented 2 months ago

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!