Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser user-agent not available in AWS Amplify #3658

Closed
5 tasks done
p00000001 opened this issue Aug 18, 2023 · 27 comments
Closed
5 tasks done

Browser user-agent not available in AWS Amplify #3658

p00000001 opened this issue Aug 18, 2023 · 27 comments
Labels
archived This issue has been locked. custom-headers feature-request New feature or request hosting

Comments

@p00000001
Copy link

p00000001 commented Aug 18, 2023

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • 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:

  1. An option to keep the original browser user-agent header and not replace it with Amazon Cloudfront
  2. Copy the original browser user-agent header into a new custom request header e.g. origin-user-agent that is accessible in AWS Amplify

Without access to user agent information, we cannot use AWS Amplify to host our app.

Reproduction steps

  1. Make a request to an AWS Amplify app from a browser
  2. Read the user-agent request header from the app

Build Settings

No response

Log output

# Put your logs below this line


Additional information

No response

@p00000001 p00000001 changed the title Browser user-agent not Browser user-agent not available in AWS Amplify Aug 18, 2023
@github-actions
Copy link

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!

@p00000001
Copy link
Author

@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.

@p00000001
Copy link
Author

p00000001 commented Sep 13, 2023

Related unresolved issues due to user agent missing #1992 #1993 #2459 #2800 #3202 #3322

@hunganhAtWhill
Copy link

bump

@belyas
Copy link

belyas commented Nov 14, 2023

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?

@ysfbsf
Copy link

ysfbsf commented Nov 14, 2023

Same issue here.

@Jyy10
Copy link

Jyy10 commented Feb 6, 2024

Same issue, seems AWS amplify team has selective blindness.

@lifehetu
Copy link

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.

@quannv
Copy link

quannv commented Apr 5, 2024

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/

@p00000001
Copy link
Author

p00000001 commented May 9, 2024

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.

@fabio-carvalho88
Copy link

bump

@fabio-carvalho88
Copy link

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?

@belyas
Copy link

belyas commented May 29, 2024

@Jay2113 any plans on this please?

@hunganhAtWhill
Copy link

bump

@StefanAleksik
Copy link

bump!

@bigtechsolution
Copy link

we have to set custom-user-agent for integrate with another solution
any planon this?

@anujmedpay
Copy link

any update here ? we are unable to find user device user-agent on server side, it shows cloudfront

@p00000001
Copy link
Author

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.

@fabio-carvalho88
Copy link

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... :/

@hidon84
Copy link

hidon84 commented Jun 12, 2024

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

@anujmedpay
Copy link

@hidon84 whats sstv2 ?

@nosmirck
Copy link

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
Copy link

hidon84 commented Jun 18, 2024

@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

@andrei1101011
Copy link

bump

@mauerbac
Copy link
Member

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/

Copy link

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.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Aug 13, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. custom-headers feature-request New feature or request hosting
Development

No branches or pull requests