Apache Whitelist reverse proxy
-
06-07-2019 - |
Question
We have a reverse proxy here, running Apache in version 2.2.x Essentially I want to create a whitelist so that only valid URLs will go through the proxy and be processed by the web server. How do you do this in the Apache config file, or do you need to use SQUID?
Solution
Create a text file with all of the valid urls and use it as a RewriteMap.
# /tmp/bar.txt:
# /blah.cgi good
# /bar.cgi bad
RewriteMap foo /foo/bar.txt
RewriteCond ${foo:%{REQUEST_URI}} ^good$
RewriteRule ^/(.*)$ proxy:http://foobackend/$1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow