mod_rewrite で外部ホストへ転送(で良いのかな?)2009/06/08

mod_rewrite には 'proxy|P' (force proxy) というフラグがあるらしい

http://httpd.apache.org/docs/2.2/ja/mod/mod_rewrite.html#rewriterule

'proxy|P' (force proxy)
  This flag forces the substitution part to be internally 
  sent as a proxy request and immediately (rewrite processing stops here) 
  1put through the proxy module. You must make sure that the 
  substitution string is a valid URI (typically starting with http://hostname) 
  which can be handled by the Apache proxy module. 
  If not, you will get an error from the proxy module. 
  Use this flag to achieve a more powerful implementation 
  of the ProxyPass directive, to map remote content into 
  the namespace of the local server.

いやまあ、とあるドメインで稼動している Apache のサブディレクトリを 全く別のホストに割り当てたいという要求があって、 リバースプロキシをかけるなら mod_proxy だろJKぐらいの勢いで用意した設定を、FQDNを割り当てられているホストの管理者に投げたら 「うちのホストは mod_proxy を有効にしていないんで(ry)」みたいな返答が返ってきた。

mod_rewrite を使って欲しいと言われたのだが、mod_rewrite なんて同一ホスト内でのパスの書き換えの黒魔法ぐらいにしか使った事がないし、試しに書き換え後のアドレスにホスト名から書いてみたところ、 'redirect|R' (force redirect) のフラグの有無に関わらず、redirectになってしまう。

「んじゃ、そっちのWebサーバからAPサーバの転送ってどうやってんの?」 と教えてもらったのが、このフラグ。

だけどさ、同じセクションに

Note: mod_proxy must be enabled in order to use this flag.

と書いてあるのだが……。

コメント

コメントをどうぞ

※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。

※なお、送られたコメントはブログの管理者が確認するまで公開されません。

名前:
メールアドレス:
URL:
コメント:

トラックバック

このエントリのトラックバックURL: http://dragonstar.asablo.jp/blog/2009/06/08/4353328/tb

※なお、送られたトラックバックはブログの管理者が確認するまで公開されません。