NAME

Apache2::S3 - mod_perl library for proxying requests to amazon S3

SYNOPSIS

PerlModule Apache2::S3;
PerlTransHandler Apache2::S3

PerlSetVar S3Key foo
PerlSetVar S3Secret bar
PerlSetVar S3Map '/path/ => amazon.s3.bucket.name'

# If you want to support non-GET requests
PerlSetVar S3ReadWrite 1

DESCRIPTION

This module will map requests for URLs on your server into proxy requests to the Amazon S3 service, adding authentication headers along the way to permit access to non-public resources.

It doesn't actually do any proxying itself, rather it just adds the required authentication fields to the request and sets up mod_proxy to handle it. Therefore you will need to enable mod_proxy like so:

ProxyRequests on

The authentication fields are added to the request as query-string parameters (i.e. after the "?"). This approach was chosen in favour of using the Authorization header because on Apache version 2.2.6 and above mod_cache can be configured to ignore the query string and cache the data while there is no way to override that behaviour for an Authorization header. To do this, use the following option:

CacheIgnoreQueryString On

If you permit modification requests (PUT/DELETE) using the S3ReadWrite feature then it is quite important that you protect the url from untrusted requests using something like the following on Apache 2.2:

<Proxy *>
  <LimitExcept GET>
    Order deny,allow
    Deny from all
    Allow from localhost
  </LimitExcept>
</Proxy>

SEE ALSO

Apache::PassThru from Chapter 7 of "Writing Apache Modules with Perl and C"
http://www.modperl.com

Amazon S3 API
http://developer.amazonwebservices.com/connect/entry.jspa?entryID=123

AUTHOR

Iain Wade, <iwade@optusnet.com.au>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Iain Wade

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.