9月 062012
 

Amazon S3 REST-API is necessary to generate signature.
vmod-awsrest generate to Authorization and Date header for Amazon S3.

How to use

VCL


import awsrest;

backend default {
  .host = "s3.amazonaws.com";
  .port = "80";
}

sub vcl_recv{
  awsrest.s3_generic(
  "accessKey",            //AWSAccessKeyId
  "secretKey",            //SecretAccessKeyID
  req.request,            //HTTP-Verb
  req.http.content-md5,   //Content-MD5
  req.http.content-type,  //Content-Type
  "",                     //canonicalizedAmzHeaders
  req.url,                //canonicalizedResource
  now                     //Date
  );
}

Output


15 TxHeader     b Date: Tue, 03 Jul 2012 16:21:47 +0000
15 TxHeader     b Authorization: AWS accessKey:XUfSbQDuOWL24PTR1qavWSr6vjM=

This module set to req.http.Authorization and req.http.Date, bereq is not use.
I recommend call in the vcl_recv.
And, be careful to default settings.
If req.http.Authorization contains, it is not caching. (default setting)

download here.
libvmod-awsrest


Reference site
PHP で Amazon S3 の REST API を使用 #1
Authenticating REST Requests

日本語はこっち
VarnishでAmazon S3の認証ヘッダを作るVMODを作ってみた


7月 112012
 

hiro_y


@xcir VarnishS3

  (@hiro_y) 7 2, 2012

AWS

S3REST-APIAuthorization
HMAC-SHA1BASE64
HMAC-SHA1Varnishvmod-digest使
BASE64VMOD
CVMOD使

使


import awsrest;

backend default {
  .host = "s3.amazonaws.com";
  .port = "80";
}

sub vcl_recv{
  awsrest.s3_generic(
  "accessKey",            //AWSAccessKeyId
  "secretKey",            //SecretAccessKeyID
  req.request,            //HTTP-Verb
  req.http.content-md5,   //Content-MD5
  req.http.content-type,  //Content-Type
  "",                     //canonicalizedAmzHeaders
  req.url,                //canonicalizedResource
  now                     //Date
  );
}


req.http.Authorizationreq.http.Date

15 TxHeader     b Date: Tue, 03 Jul 2012 16:21:47 +0000
15 TxHeader     b Authorization: AWS accessKey:XUfSbQDuOWL24PTR1qavWSr6vjM=


bereqvcl_recv

AuthorizationVCL
VCLreq.http.Authorizationpass



downloadlibvmod-awsrest



PHP  Amazon S3  REST API 使 #1
Authenticating REST Requests