Created
July 7, 2018 18:59
-
-
Save badpenguin/e1993eda055aa0f8d2f25bd699689328 to your computer and use it in GitHub Desktop.
Allow access to Wordpress only if user has passed thru another page first and gathered a special cookie
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 characters
set $cicciopasticcio 0; | |
if ($request_uri ~* "/wp-admin|/wp-login.php") { | |
set $cicciopasticcio 1; | |
} | |
if ($request_uri ~* "/wp-admin/admin-ajax.php") { | |
set $cicciopasticcio 0; | |
} | |
if ($cookie_cicciopasticcio != "nginx") { | |
set $cicciopasticcio "${cicciopasticcio}1"; | |
} | |
if ($cicciopasticcio = 11) { | |
return 404; | |
} | |
location = /cicciopasticcio.php { | |
add_header X-Debug "cicciopasticcio" always; | |
set $cache_skip 1; | |
set $cache_uri ''; | |
add_header Set-Cookie "cicciopasticcio=nginx;path=/;max-age=3153600000"; | |
return 302 /wp-login.php; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment