web-dev-qa-db-ja.com

ProxypassディレクティブにはProxyPassReverseディレクティブが必要ですか?

すべてのProxyPassディレクティブにはProxyPassReverseディレクティブが必要ですか?

ProxyPass / http://foo.example.com:8080/  
ProxyPassReverse / http://www.example.com/

私はこのスニペットを見て、すべてのトラフィックがfoo.example.comはfoo.example.com:8080にプロキシされます。 2行目は何をしますか?

20
theTuxRacer

このディレクティブを使用すると、ApacheはHTTPリダイレクト応答のLocation、Content-Location、URIヘッダーのURLを調整できます

たとえば、ローカルサーバーのアドレスが http://example.com/ であるとします。その後

ProxyPass /mirror/foo/ http://backend.example.com/
ProxyPassReverse /mirror/foo/ http://backend.example.com/
ProxyPassReverseCookieDomain backend.example.com public.example.com
ProxyPassReverseCookiePath / /mirror/foo/

http://example.com/mirror/foo/bar に対するローカルリクエストが内部的に http://backend.example。 com/bar (ProxyPassがここで提供する機能)。また、サーバーbackend.example.comが送信するリダイレクトも処理します。 http://backend.example.com/bar が彼によってリダイレクトされた場合 http://backend.example .com/quux Apacheはこれを http://example.com/mirror/foo/quux に調整してから、HTTPリダイレクト応答をクライアントに転送します。 URLの構築に使用されるホスト名は、UseCanonicalNameディレクティブの設定に基づいて選択されることに注意してください。

15
alvosu