I have some web content behind the follwoing arch, for which I need to serve different content for desktop and mobile clients.
client > AWS Cloudfront > Nginx > ...
cloudfront has the builtin ability to identify the user-agent and they kind of unify it into 4 special headers (for example CloudFront-Is-Desktop-Viewer) which are either true or false.
on Nginx I'm trying to decide which content to serve according to those headers. for example:
location / {
if ($http_CloudFront-Is-Desktop-Viewer = true) {
proxy_pass http://upstream;
break;
}
root /var/www/static/en-US;
try_files $uri /index.html;
}
so in the above case it should go to the upstream if the CloudFront-Is-Desktop-Viewer value is true, and get the static files from nginx if it's false or not present.
but for some reason I always get the static files from nginx. I'm sure this header is being forwarded, I've even tried to send it directly from chrome with a header modifier.
what am i missing?
many thanks
Aucun commentaire:
Enregistrer un commentaire