{"id":1200,"date":"2012-07-11T02:37:24","date_gmt":"2012-07-10T17:37:24","guid":{"rendered":"http:\/\/blog.xcir.net\/?p=1200"},"modified":"2012-07-11T02:41:54","modified_gmt":"2012-07-10T17:41:54","slug":"varnish%e3%81%a7amazon-s3%e3%81%ae%e8%aa%8d%e8%a8%bc%e3%83%98%e3%83%83%e3%83%80%e3%82%92%e4%bd%9c%e3%82%8bvmod%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/blog.xcir.net\/?p=1200","title":{"rendered":"Varnish\u3067Amazon S3\u306e\u8a8d\u8a3c\u30d8\u30c3\u30c0\u3092\u4f5c\u308bVMOD\u3092\u4f5c\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>hiro_y\u3055\u3093\u304b\u3089\u3053\u3093\u306a\u8cea\u554f\u3092\u53d7\u3051\u305f\u306e\u3067<\/p>\n<blockquote class=\"twitter-tweet\" data-in-reply-to=\"219701871806386176\" lang=\"ja\">\n<p>@<a href=\"https:\/\/twitter.com\/xcir\">xcir<\/a> Varnish\u304b\u3089S3\u306e\u8a8d\u8a3c\u7a81\u7834\u3059\u308b\u65b9\u6cd5\u3068\u304b\u3054\u5b58\u77e5\u306a\u3044\u3067\u3059\u304b\u2026\u3068\u601d\u3044\u307e\u3057\u3066<\/p>\n<p>&mdash; \u5c71\u5ca1\u5e83\u5e78\u3055\u3093 (@hiro_y) <a href=\"https:\/\/twitter.com\/hiro_y\/status\/219701982674423808\" data-datetime=\"2012-07-02T08:00:09+00:00\">7\u6708 2, 2012<\/a><\/p><\/blockquote>\n<p><script src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><br \/>\nAWS\u306e\u52c9\u5f37\u304c\u3066\u3089\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>S3\u306eREST-API\u306eAuthorization\u30d8\u30c3\u30c0\u306f\u3001\u65e5\u4ed8\u3084\u30ea\u30bd\u30fc\u30b9\u306e\u5834\u6240\u306a\u3069\u3092\u6539\u884c\u3067\u7d50\u5408\u3057\u3066<br \/>\nHMAC-SHA1\u3067\u30cf\u30c3\u30b7\u30e5\u5316\u3057\u3066\u3001BASE64\u30a8\u30f3\u30b3\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nHMAC-SHA1\u306b\u3064\u3044\u3066\u306f\u3001Varnish\u516c\u5f0f\u304c\u516c\u958b\u3057\u3066\u3044\u308b<a href=\"https:\/\/github.com\/varnish\/libvmod-digest\">vmod-digest<\/a>\u3092\u4f7f\u3046\u3053\u3068\u3067\u3067\u304d\u308b\u306e\u3067\u3059\u304c<br \/>\n\u51fa\u529b\u3092BASE64\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u30b3\u30fc\u30c9\u3092\u62dd\u501f\u3057\u3066\u4eca\u56de\u306eVMOD\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3061\u306a\u307f\u306b\u6539\u884c\u3092\u6271\u3046\u3053\u3068\u306b\u3064\u3044\u3066\u3082\u3001\u30a4\u30f3\u30e9\u30a4\u30f3C\u304bVMOD\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u4f7f\u3044\u65b9<\/h3>\n<pre class=\"brush: plain; \">\n\r\nimport awsrest;\r\n\r\nbackend default {\r\n  .host = &quot;s3.amazonaws.com&quot;;\r\n  .port = &quot;80&quot;;\r\n}\r\n\r\nsub vcl_recv{\r\n  awsrest.s3_generic(\r\n  &quot;accessKey&quot;,            \/\/AWSAccessKeyId\r\n  &quot;secretKey&quot;,            \/\/SecretAccessKeyID\r\n  req.request,            \/\/HTTP-Verb\r\n  req.http.content-md5,   \/\/Content-MD5\r\n  req.http.content-type,  \/\/Content-Type\r\n  &quot;&quot;,                     \/\/canonicalizedAmzHeaders\r\n  req.url,                \/\/canonicalizedResource\r\n  now                     \/\/Date\r\n  );\r\n}\r\n\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u3059\u3068req.http.Authorization\u3068req.http.Date\u306b\u751f\u6210\u3057\u305f\u30d8\u30c3\u30c0\u304c\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\n15 TxHeader     b Date: Tue, 03 Jul 2012 16:21:47 +0000\r\n15 TxHeader     b Authorization: AWS accessKey:XUfSbQDuOWL24PTR1qavWSr6vjM=\r\n\n<\/pre>\n<p>\u30bb\u30c3\u30c8\u3055\u308c\u308b\u306e\u304cbereq\u3067\u306f\u306a\u3044\u306e\u3067vcl_recv\u3067\u547c\u3073\u51fa\u3059\u3053\u3068\u3092\u63a8\u5968\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305fAuthorization\u3092\u751f\u6210\u3059\u308b\u306e\u3067\u3082\u3057\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306f\u9069\u5207\u306bVCL\u3092\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u306eVCL\u3067\u306freq.http.Authorization\u3092\u542b\u3080\u5834\u5408\u306fpass\u3059\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u50d5\u306e\u65b9\u3067\u3082\u7c21\u5358\u306a\u52d5\u4f5c\u30c1\u30a7\u30c3\u30af\u3092\u884c\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3082\u3057\u5909\u306a\u52d5\u304d\u3092\u3057\u305f\u3089\u6559\u3048\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/xcir\/libvmod-awsrest\">download\u306f\u3053\u3061\u3089\uff08libvmod-awsrest\uff09<\/a><\/p>\n<p>&#8212;<br \/>\n\u53c2\u8003\u30b5\u30a4\u30c8<br \/>\n<a href=\"http:\/\/www.applelife100.com\/2012\/06\/23\/using-rest-api-of-amazon-s3-in-php-1\/\">PHP \u3067 Amazon S3 \u306e REST API \u3092\u4f7f\u7528 #1<\/a><br \/>\n<a href=\"http:\/\/s3.amazonaws.com\/doc\/s3-developer-guide\/RESTAuthentication.html\">Authenticating REST Requests<\/a><\/p>\n<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_hatena\"><a href='\/\/b.hatena.ne.jp\/add?mode=confirm&url=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D1200&title=Varnish%E3%81%A7Amazon%20S3%E3%81%AE%E8%AA%8D%E8%A8%BC%E3%83%98%E3%83%83%E3%83%80%E3%82%92%E4%BD%9C%E3%82%8BVMOD%E3%82%92%E4%BD%9C%E3%81%A3%E3%81%A6%E3%81%BF%E3%81%9F' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/hatena.gif' alt='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' width='16' height='12' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_hatena_users\"><a href='\/\/b.hatena.ne.jp\/entry\/https:\/\/blog.xcir.net\/?p=1200' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish\u3067Amazon S3\u306e\u8a8d\u8a3c\u30d8\u30c3\u30c0\u3092\u4f5c\u308bVMOD\u3092\u4f5c\u3063\u3066\u307f\u305f' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='\/\/b.hatena.ne.jp\/entry\/image\/https:\/\/blog.xcir.net\/?p=1200' alt='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish\u3067Amazon S3\u306e\u8a8d\u8a3c\u30d8\u30c3\u30c0\u3092\u4f5c\u308bVMOD\u3092\u4f5c\u3063\u3066\u307f\u305f' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish\u3067Amazon S3\u306e\u8a8d\u8a3c\u30d8\u30c3\u30c0\u3092\u4f5c\u308bVMOD\u3092\u4f5c\u3063\u3066\u307f\u305f'   class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_facebook\"><a href='http:\/\/www.facebook.com\/share.php?u=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D1200&t=Varnish%E3%81%A7Amazon%20S3%E3%81%AE%E8%AA%8D%E8%A8%BC%E3%83%98%E3%83%83%E3%83%80%E3%82%92%E4%BD%9C%E3%82%8BVMOD%E3%82%92%E4%BD%9C%E3%81%A3%E3%81%A6%E3%81%BF%E3%81%9F' title='Facebook \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/facebook.png' alt='Facebook \u306b\u30b7\u30a7\u30a2' title='Facebook \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_linkedin\"><a href='\/\/www.linkedin.com\/shareArticle?mini=true&url=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D1200&title=Varnish%E3%81%A7Amazon%20S3%E3%81%AE%E8%AA%8D%E8%A8%BC%E3%83%98%E3%83%83%E3%83%80%E3%82%92%E4%BD%9C%E3%82%8BVMOD%E3%82%92%E4%BD%9C%E3%81%A3%E3%81%A6%E3%81%BF%E3%81%9F' title='LinkedIn \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/linkedin.png' alt='LinkedIn \u306b\u30b7\u30a7\u30a2' title='LinkedIn \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/blog.xcir.net\/?p=1200\" data-text=\"Varnish\u3067Amazon S3\u306e\u8a8d\u8a3c\u30d8\u30c3\u30c0\u3092\u4f5c\u308bVMOD\u3092\u4f5c\u3063\u3066\u307f\u305f\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>hiro_y\u3055\u3093\u304b\u3089\u3053\u3093\u306a\u8cea\u554f\u3092\u53d7\u3051\u305f\u306e\u3067 @xcir Varnish\u304b\u3089S3\u306e\u8a8d\u8a3c\u7a81\u7834\u3059\u308b\u65b9\u6cd5\u3068\u304b\u3054\u5b58\u77e5\u306a\u3044\u3067\u3059\u304b\u2026\u3068\u601d\u3044\u307e\u3057\u3066 &mdash; \u5c71\u5ca1\u5e83\u5e78\u3055\u3093 (@hiro_y) 7\u6708 2, 2012 AWS\u306e\u52c9\u5f37\u304c\u3066 <a href='https:\/\/blog.xcir.net\/?p=1200' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[5,33,34,44],"class_list":["post-1200","post","type-post","status-publish","format-standard","hentry","category-3","tag-varnish","tag-varnish3-0-2","tag-vmod","tag-vmod_awsrest","category-3-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/1200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1200"}],"version-history":[{"count":17,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/1200\/revisions"}],"predecessor-version":[{"id":1321,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/1200\/revisions\/1321"}],"wp:attachment":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}