Last active
May 16, 2019 15:32
-
-
Save tunght13488/b955302dcb45afb1cfa9 to your computer and use it in GitHub Desktop.
Revisions
-
tunght13488 revised this gist
Nov 4, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # See: http://www.jonathanquail.com/blog/2012/05/09/restricting-access-to-servers-behind-an-elastic-load-balancer/ # Extract client IP #SetEnvIf REMOTE_ADDR "(.+)" CLIENTIP=$1 # If request is forwarded, use forwarded IP instead SetEnvIf X-Forwarded-For "^([0-9.]+)" CLIENTIP=$1 # If request is not forwarded, set a flag -
tunght13488 created this gist
Nov 4, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ # Extract client IP SetEnvIf REMOTE_ADDR "(.+)" CLIENTIP=$1 # If request is forwarded, use forwarded IP instead SetEnvIf X-Forwarded-For "^([0-9.]+)" CLIENTIP=$1 # If request is not forwarded, set a flag SetEnvIf X-Forwarded-For "^$" is_not_forwarded # Whitelist SetEnvIf CLIENTIP "173.55.53.87" allowed_in SetEnvIf CLIENTIP "72.67.47.197" allowed_in # Rules Order deny,allow Deny from all # Allow whitelisted forwarded IP Allow from env=allowed_in # Allow request which is not forwarded (healthcheck) Allow from env=is_not_forwarded # Remove comment from the following line to let everyone in #Allow from all