Serve files by alias

Hi there.

I’d like to serve a bunch of files stored in the filesystem. Unlike
serving them directly by their name, I would like to have them served
by ID, e.g. like

http://example.com/file/1337 serves /u01/media/some.ogm
http://example.com/file/2342 serves /u01/media/other.ogm

Further I need to add (and eventually modify) headers in the
response created by the webserver.

I choosed to do realize it with mongrel, because webrick is told
to be slow serving big files. I choosed not to use e.g. nginx
directly, because the application should be easily deployable on
different platforms where ruby is available, without compiling
needed and spending much time getting it work in some special
platform.

Now to my problem… :slight_smile:

I wasn’t able to figure out, how to “link” static files into the
webspace, like the Alias directive of apache e.g…

The idea was that mongrel should serve e.g. /u01/media/some.ogm
if /file/1337 is requested and the header modification would be
done by a handler hooked onto /file.

Is that possible, or have I read to and send the files on my own
by a servlet?

I’d be very happy for comments, tips or sample code regarding this
topic.

Thanks in advance!

Erik.

PS: It’s a pity that you blacklist posting from Tor nodes.
I understand that some people could abuse it for spamming, but
please also think about that not everybody has the luxury to use
the internet unanonymously without beeing afraid, for whatever
reasons.
It took my ages to send this post to your site, chaining tor with
other proxy.