aws-amplify / aws-amplify/amplify-hosting
Amplify Access logs always show no Cookies
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have removed any sensitive information from my code snippets and submission.
### 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** :
- Use "S3+Cloud Front" Hosting but my application is Next JS SSR application and manual hosting not supported for Next JS SSR application in Amplify.
### Describe how you'd like this feature to work
Provide Support for cookie logging in Amplify managed Cloud Front Distribution.
Contributor guide
Research direction
Start with the Amplify-managed CloudFront configuration described in the issue, especially the Headers and Cookie logging settings. Confirm whether this repository contains the relevant hosting configuration or implementation entry point; the issue names no files or tests. Done means cookies from this setup appear in Amplify access logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud, infrastructure, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100