duskload / react-device-detect

Detect device, and render view according to detected device type.
MIT License
2.82k stars 155 forks source link

AWS Amplify masks my user-agent header. #211

Open caiodounis opened 1 year ago

caiodounis commented 1 year ago

This is working well in my local but it's not working in my live project. After deploying a Next.js app on AWS Amplify when inspecting the request headers, the User Agent header is Amazon CloudFront instead of the user's user agent.

Do you guys have any idea how to fix this?

saint777 commented 1 year ago

Probably in AWS settings

mauricioA0 commented 1 year ago

are you using Next?

p00000001 commented 1 year ago

@caiodounis - did you ever find a solution for this? I have the same problem with a Next.js app hosted on AWS Amplify

belyas commented 1 year ago

Anyone has found a solution for this, I'm experiencing recently the same issue, we've just playing with Amplify to see if it's a good choice to move to or not, but this user agent forwarding is a pain, any help would be appreciated

TimMikeladze commented 1 year ago

I'm not sure how accurate this workaround is but in my case I logged the incoming headers and noticed that the following headers have some information about the user agent.

const browser = headers[`sec-ch-ua`];

const platform = headers[`sec-ch-ua-platform`];
belyas commented 1 year ago

Thanks @TimMikeladze yes I noticed those headers, they're unfortunately unreliable as they're still experimental headers and some vendors don't send them

p00000001 commented 1 year ago

@belyas Still waiting! I raised this as a bug in AWS Amplify but they changed it to a feature request and haven't given any feedback. Any additional thumbs-up on the issue would be useful to try and get them to look at it:

https://github.com/aws-amplify/amplify-hosting/issues/3658

belyas commented 1 year ago

@belyas Still waiting! I raised this as a bug in AWS Amplify but they changed it to a feature request and haven't given any feedback. Any additional thumbs-up on the issue would be useful to try and get them to look at it:

aws-amplify/amplify-hosting#3658

Thanks @p00000001 I did leave a thumbs-up and a comment to boost it hopefully or at least some useful/sustainable workaround at least for now