Created
January 8, 2021 13:35
-
-
Save hn-support/3d0ec225e7fd49e6996377e48996f57c to your computer and use it in GitHub Desktop.
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
# You can whitelist request that should be exempt from the development | |
# basic auth. | |
# It's possible to whitelist request based on their IP address, range, | |
# User-Agent, or by the requested URL. | |
# Please note though, that google and bing bots will always remain | |
# blocked on development nodes! | |
# Both IP addresses and IP ranges can be whitelisted here. | |
geo $development_exceptions_ip { | |
default "Development restricted area"; | |
127.0.0.1/32 "off"; | |
} | |
# It's also possible to whitelist specific user agents | |
map $http_user_agent $development_exceptions_ua { | |
default $development_exceptions_ip; | |
~*(magereport|letsencrypt) "off"; | |
} | |
# You can exclude specific URL's from the development | |
# basic auth. | |
# The whitelist is based on the entire request. | |
# If you wish to whitelist an entire path, you'll need | |
# to use a regular expression. | |
map $request_uri $development_exceptions { | |
default $development_exceptions_ua; | |
/robots.txt "off"; | |
# ~^(/index\.php)/rest/V1 "off"; | |
} |
Hey @andy-igoo ! Thanks for the comment. This snipped was made to work if you use all three options, as they 'chain' on to each other. I'll see about expanding the docs to point that out, as without it you indeed need to change the snippet to what yours read.
I tried to allow a user agent, "user_agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/85.0.4183.121 Safari/537.36 (compatible; Cloudflare SpeedTest/1.0; +https://blog.cloudflare.com/new-speed-page/)"
I used this statement:
map $http_user_agent $development_exceptions_ua {
default $development_exceptions_ip;
~*(Cloudflare) "off";
}
But it does not allow the user agent
Hi,
can you give an example how i can whitelist a url like https://example.com/api/<> ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@hn-support On the last example
$development_exceptions_ua
is caused an error:I tested with: