Skip to content

Instantly share code, notes, and snippets.

@koheyamada
Created April 14, 2016 08:53
Show Gist options
  • Save koheyamada/d0196dedc3271e5622beb3ea93b96309 to your computer and use it in GitHub Desktop.
Save koheyamada/d0196dedc3271e5622beb3ea93b96309 to your computer and use it in GitHub Desktop.
CloudFrontを導入してもUser-agentの値は書き換えられないようにする方法。 ref: http://qiita.com/kooohei/items/4dcdb506745a6a1eef66
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17
Amazon CloudFront
<?php
$ua = $_SERVER["HTTP_USER_AGENT"];
echo "$ua";
?>
CloudFront-Is-Desktop-Viewer
CloudFront-Is-Mobile-Viewer
CloudFront-Is-SmartTV-Viewer
CloudFront-Is-Tablet-Viewer
"Some headers have a lot of possible values, and caching based on the values in these headers would cause CloudFront to forward more requests to your origin. We recommend that you do not cache based on the following headers: User-Agent"
いくつかのヘッダーは多くの値を持ち、それらのヘッダーの値をもとにキャッシュしているため、CloudFrontが多くのリクエストをオリジンへ転送する要因となります。私たちは次のヘッダーをキャッシュしないことを薦めます。User-Agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment