日向夏特殊応援部隊

俺様向けメモ

X-Sendfile, X-REPROXY-FILE, X-REPROXY-URL

d:id:spiritloose:20061025:1161770915

ApacheでもlighttpdのX-Sendfileが使えるみたい。
ここで言及されてるX-REPROXY-FILEなんだけど、Perlbalの機能です。

付属のdocにあるreproxying.txtによると、

This can be useful for having URLs that get mapped to files on disk without
giving users enough information to map out your directory structure. For
example, you can create a file structure such as:

/home/pics/$userid/$pic

Then you can have URLs such as:

http://foo.com/mysite/users/$userid/picture/$pic

When this URL gets passed to the backend web node, it could return a simple
response that includes this header:

X-REPROXY-FILE: /home/pics/$userid/$pic

Perlbal will then use asynchronous IO to send the file to the user without
slowing down Perlbal at all.

とあるので、ちとlighttpdのX-Sendfileを勘違いしてる鴨ですが、
単純にPerlbalがアクセス可能なファイルシステムに対するPATHを記述すると
Perlbalが代理でファイルの内容を取得して返すってだけじゃないのかなぁ。。。
だから僕の理解*1だとX-Sendfile = X-REPROXY-FILE なんだけどどうすかね。

MogileFSとの組み合わせだと最強だと思われるのが、X-REPROXY-URLですかね。

This support also extens to URLs that can be located anywhere Perlbal has
access to. It's the same syntax, nearly:

X-REPROXY-URL: http://foo.com:80/resource.html

You can also specify multiple URLs:

X-REPROXY-URL: http://foo.com:80/resource.html http://baz.com:8080/res.htm

Just specify any number of space separated URLs. Perlbal will request them
one by one until one returns a response code of 200. At that point Perlbal
will proxy the response back to the user just like normal.

って訳でバックエンドのストレージノードのURLを列挙してあげれば、
代わりに取りに行ってくれるって理解で合ってるはず。


ちとそのうち試して追って報告するです。(誰?

*1:まだ未検証だけどもw