Category Archives: Apache

Appending request headers to a request forwarded by mod_rewrite

Set an environment variable using env flag in RewriteRule and use it in RequestHeader append.

  RewriteEngine on
  RewriteRule ^/(.*)$ http://appserver/$1 [P,L,QSA,env=ORG_REMOTE_ADDR:%{REMOTE_ADDR}]
  ProxyPassReverse / http://appserver/
  RequestHeader append X_ORG_REMOTE_ADDR %{ORG_REMOTE_ADDR}e env=ORG_REMOTE_ADDR
  RequestHeader append X-Forwarded-Proto https

mod_rewrite - Apache HTTP Server
たまねぎプログラマハマリ日記:Apache内のCGI環境変数をTomcatに渡す。 - livedoor Blog(ブログ)