14

How can use X-Forwarded-For headers(my proxy ip 10.1.1.x) to allow HTTP query?

bindbn
  • 5,321

3 Answers3

25

You can use SetEnvIf and Allow:

    <Location "/only_proxy/">
            SetEnvIf X-Forwarded-For ^10\.1\.1\. proxy_env
            Order allow,deny
            Satisfy Any
            Allow from env=proxy_env
    </Location>
ooshro
  • 11,502
4

You can write a rewrite rule to redirect to 403 response.

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-For} !(1.1.1.1|2.2.2.2)
RewriteRule .* - [F]
Jenny D
  • 28,400
  • 21
  • 80
  • 117
2

You can use mod_rpaf to make Apache treat the X-Forwarded-For IP as the client IP.

ThatGraemeGuy
  • 15,788