nginx_ua_block_pleroma_rejects: Changed to string-matching.
Do string-matching instead of regular expressions.
This commit is contained in:
parent
186192d968
commit
e62e2c52cb
|
@ -4,7 +4,7 @@
|
||||||
# Save the output to a file and include it in an nginx configuration file. Then
|
# Save the output to a file and include it in an nginx configuration file. Then
|
||||||
# add `if ($blockedagent) { return 403; }` to your server blocks.
|
# add `if ($blockedagent) { return 403; }` to your server blocks.
|
||||||
|
|
||||||
# Version: 2019-08-17_3
|
# Version: 2019-08-18_1
|
||||||
|
|
||||||
|
|
||||||
function get_domains() # Output domains, separated by newline.
|
function get_domains() # Output domains, separated by newline.
|
||||||
|
@ -21,11 +21,10 @@ function print_entry() # Output map entry.
|
||||||
{
|
{
|
||||||
local domain="${1}"
|
local domain="${1}"
|
||||||
|
|
||||||
# Transform strings to regular expressions.
|
# Remove wildcards.
|
||||||
domain=$(sed 's/\./\\./g' <<<${domain}) # . → \.
|
domain=$(sed 's/\*//g' <<<${domain})
|
||||||
domain=$(sed 's/\*/.*/g' <<<${domain}) # * → .*
|
|
||||||
|
|
||||||
echo " ~*${domain} 1;"
|
echo " ~^${domain} 1;"
|
||||||
}
|
}
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
|
|
Loading…
Reference in New Issue