Browser user-agent not available in AWS Amplify
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
App Id
d3qizoh4juhaxq
AWS Region
eu-west-2
Amplify Hosting feature
Frontend builds
Frontend framework
Next.js
Next.js version
13.4.16
Next.js router
App Router
Describe the bug
The request user-agent header always has a fixed value of Amazon Cloudfront when read in AWS Amplify apps.
Like many apps, we rely on the user-agent header to customize the response and for statistical logging.
Expected behavior
There appears to be no way to access the user's user-agent data from AWS Amplify. Either of the following solutions would be okay:
- An option to keep the original browser
user-agentheader and not replace it withAmazon Cloudfront - Copy the original browser
user-agentheader into a new custom request header e.g.origin-user-agentthat is accessible in AWS Amplify
Without access to user agent information, we cannot use AWS Amplify to host our app.
Reproduction steps
- Make a request to an AWS Amplify app from a browser
- Read the
user-agentrequest header from the app
Build Settings
No response
Log output
# Put your logs below this line
Additional information
No response
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!
@Jay2113 are you able to give any indication whether there are any plans to implement access to the original user-agent or similar in the near-future on Amplify? Looking further, I see other people have raised similar issues over the past couple of years but there has been no indication if this is even on the road map. We can't deploy to Amplify without access to the user agent, so I would be grateful to understand is there are plans to support this? Many thanks.
Related unresolved issues due to user agent missing #1992 #1993 #2459 #2800 #3202 #3322
bump
Any news on this, please? we're about to migrate to Amplify and this seems to be an obstacle for us to move, is there any ETA please? or some workaround for now?
@Jay2113 any tips/tricks here please?
Same issue here.
Same issue, seems AWS amplify team has selective blindness.
This is very important to us too. We too need to have access to the user agent.
Someone please respond and let us know when this issue will be resolved.
@swaminator by any chance, do you have any news on this regard?
I got the same issue, SSR on vercel is too slow, Amplify is better but got this problem, i don't know why a problem was affected to many developer that AWS does not resolve it My website can not check to display mobile menu: https://kapanda.com/
CloudFront implemented a solution for this a couple of years ago to control origin request headers so CloudFront can forward on the user-agent header without it being part of the CloudFront cache key:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html
I don't understand why Amplify won't give us this option, or even just expose the CloudFront distribution that Amplify creates behind-the-scenes so we can edit the settings in CloudFront.
bump
CloudFront implemented a solution for this a couple of years ago to control origin request headers so CloudFront can forward on the user-agent header without it being part of the CloudFront cache key:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html
I don't understand why Amplify won't give us this option, or even just expose the CloudFront distribution that Amplify creates behind-the-scenes so we can edit the settings in CloudFront.
CloudFront implemented a solution for this a couple of years ago to control origin request headers so CloudFront can forward on the user-agent header without it being part of the CloudFront cache key:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html
I don't understand why Amplify won't give us this option, or even just expose the CloudFront distribution that Amplify creates behind-the-scenes so we can edit the settings in CloudFront.
can this be used as a workaround? it would imply extra costs, right?
@Jay2113 any plans on this please?
bump
bump!
we have to set custom-user-agent for integrate with another solution any planon this?
any update here ? we are unable to find user device user-agent on server side, it shows cloudfront
CloudFront implemented a solution for this a couple of years ago to control origin request headers so CloudFront can forward on the user-agent header without it being part of the CloudFront cache key: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html I don't understand why Amplify won't give us this option, or even just expose the CloudFront distribution that Amplify creates behind-the-scenes so we can edit the settings in CloudFront.
can this be used as a workaround? it would imply extra costs, right?
@fabio-carvalho88 I don't think it's something we can do without a technical change from AWS. My understanding is each AWS Amplify instance is packaged with a hidden instance of Cloudfront, and we do not have access to change any of its settings.
CloudFront implemented a solution for this a couple of years ago to control origin request headers so CloudFront can forward on the user-agent header without it being part of the CloudFront cache key: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html I don't understand why Amplify won't give us this option, or even just expose the CloudFront distribution that Amplify creates behind-the-scenes so we can edit the settings in CloudFront.
can this be used as a workaround? it would imply extra costs, right?
@fabio-carvalho88 I don't think it's something we can do without a technical change from AWS. My understanding is each AWS Amplify instance is packaged with a hidden instance of Cloudfront, and we do not have access to change any of its settings.
yup, that's what I think as well... :/
in my case , i migrate from amplify to sstv2 because of this reason if you want to change user-agent then i recommed to use sstv2
@hidon84 whats sstv2 ?
I'm having the same issue, I'm thinking of migrating to Google Cloud Run because of this. My app depends on the user agent to detect what link to serve to the user, what features are available and how to communicate to the device.
Also, this project has not been actively worked in months, I'm afraid it might be abandoned. Are there any other alternatives we can use with AWS or should I just move out?
@hidon84 whats sstv2 ? this is https://sst.dev/
it use opennext , and work perfectly in my use case. if you want cloudfront mannually , then i recommed this project
bump
This feature has just been supported with our latest launch! Closing.
Check out the details here: https://aws.amazon.com/blogs/mobile/cdn-caching-improvements-for-better-app-performance-with-aws-amplify-hosting/
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
This issue has been automatically locked.