[users] Use dbd RewriteMap to map user friendly URLs to files in an object store

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello,

this is our business case:
- we have an object store where we keep video and audio files, each file identified by a technical key
- we can access this object store with the S3 protocol via http (example: http://internal-object-store.de/bucket/key)
- we want to put a reverse proxy in front of the S3 gateway to deliver the files and map user friendly urls to the technical keys (example: http://videoserver.de/myNewVideo.mp4 -> http://internal-object-store.de/bucket/key)
- the mappings must be in a database because there are new mappings every hour for new files, and we delete the mappings for files that are no longer publicly available

From the documentation of mod_rewrite I found that we could achieve this with a dbd RewriteMap (starting with httpd 2.4). I found very few discussions about the dbd RewriteMap via Google but at last I got a basic working example.

<VirtualHost *:80>
    ServerName         myserver.de

    DBDriver mysql
    DBDParams "host=my-db-host.de,port=3306,user=user,pass=pw,dbname=name"
    DBDPersist On
    DBDPrepareSQL "select S3_PATH from MAPPINGS where URL = "" mappath

    RewriteEngine On
    RewriteMap avfile "dbd:select S3_PATH from MAPPINGS where URL = "">
    RewriteRule ^/s3(.*) http://internal-object-store.de${avfile:$1} [P]

</VirtualHost>

I was not able to use the label "mappath" of the prepared statement as a reference in the RewriteMap directive.
for example: 
RewriteMap avfile dbd:mappath
did not work.

Here are my questions:
Can the prepared statement be used in the RewriteMap? (And how?)
Has anybody experience with the dbd RewriteMap in production? 
Are there any known pitfalls?
Would it be advisable to use a different approach. For example with mod_lua?

Thank you and best regards,
Julian


--
Viele Grüße,
Julian Sareyka


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux