You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CDNs usually don't forward the user-agents to the servers, or they override it with their own user-agent, usually ins this situation, they send some custom headers with the requisition, cloudfront for example:
Would a feature that allows the developer to pass in their own custom uaresults to the provider or something similar make sense in this case?
A workaround / alternative I'm using in the moment is to just fake a ua in the code and pass it down to the provider...
if(userAgent==='Amazon CloudFront'){userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36';if(props.ctx.req.headers['cloudfront-is-tablet-viewer']==='true'){userAgent='Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1';}elseif(props.ctx.req.headers['cloudfront-is-mobile-viewer']==='true'){userAgent='Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1';}}
Great library btw, ty for making it open sourced.
Feel free to close it if you think the dev should just use the workaround, just posting this to bring up some ideas and a place where ppl can find a workaround if they face this problem.
The text was updated successfully, but these errors were encountered:
Indeed it's annoying that CDN's don't forward the request user-agent... This library is just a simpler api around the ua-parser-js library so I prefer to avoid escape hatches like allowing users to override the results themselves.
I think your solution is perfectly fine! I would just write tests to make sure the "fake detection" doesn't break in a future version of ua-parser-js (unlikely but you never know)
CDNs usually don't forward the user-agents to the servers, or they override it with their own user-agent, usually ins this situation, they send some custom headers with the requisition, cloudfront for example:
Would a feature that allows the developer to pass in their own custom uaresults to the provider or something similar make sense in this case?
A workaround / alternative I'm using in the moment is to just fake a ua in the code and pass it down to the provider...
Great library btw, ty for making it open sourced.
Feel free to close it if you think the dev should just use the workaround, just posting this to bring up some ideas and a place where ppl can find a workaround if they face this problem.
The text was updated successfully, but these errors were encountered: