Commit f40bcbb2 authored by omega8cc's avatar omega8cc

Issue #1524860 by omega8cc - Empty response 444 in Nginx confuses search bots.

parent dfd6a122
......@@ -5,31 +5,31 @@
set $nocache_details "Cache";
###
### Deny crawlers without 403 response.
### Deny crawlers.
###
if ($is_crawler) {
return 444;
return 403;
}
###
### Deny not compatible request methods without 405 response.
###
if ( $request_method !~ ^(?:GET|HEAD|POST)$ ) {
return 444;
return 403;
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
if ($is_denied) {
return 444;
return 403;
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
location ~* (?:delete.+from|insert.+into|select.+from|union.+select|onload|\.php.+src|system\(.+|document\.cookie|\;|\.\.) {
return 444;
return 403;
}
###
......@@ -78,12 +78,12 @@ location = /core/cron.php {
###
### Send search to php-fpm early so searching for node.js will work.
### Deny bots on search uri without 403 response.
### Deny bots on search uri.
###
location ^~ /search {
location ~* ^/search {
if ($is_bot) {
return 444;
return 403;
}
try_files $uri @cache;
}
......@@ -94,7 +94,7 @@ location ^~ /search {
###
location ~* /(?:autocomplete|ajax|ahah)/ {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
log_not_found off;
......@@ -130,7 +130,7 @@ location ^~ /hosting {
###
location ^~ /admin {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -143,7 +143,7 @@ location ^~ /admin {
location ^~ /audio/download {
location ~* ^/audio/download/.*/.*\.(?:mp3|mp4|m4a|ogg)$ {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -152,10 +152,10 @@ location ^~ /audio/download {
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
location ~* (/\..*|settings\.php$|\.(?:git|htaccess|engine|inc|info|install|module|profile|pl|po|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)$|^(?:Entries.*|Repository|Root|Tag|Template))$ {
return 444;
return 403;
}
###
......@@ -163,15 +163,15 @@ location ~* (/\..*|settings\.php$|\.(?:git|htaccess|engine|inc|info|install|modu
###
location ~* (?:cgi-bin|vti-bin|wp-content) {
access_log off;
return 444;
return 403;
}
###
### Deny bots on some weak modules uri without 403 response.
### Deny bots on some weak modules uri.
###
location ~* (?:calendar|event|validation|aggregator|vote_up_down|captcha) {
if ($is_bot) {
return 444;
return 403;
}
try_files $uri @cache;
}
......@@ -439,11 +439,11 @@ location ~* \.xml$ {
}
###
### Deny bots on never cached uri without 403 response.
### Deny bots on never cached uri.
###
location ~* ^/(?:.*/)?(?:user|cart|checkout|logout|flag) {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -451,11 +451,11 @@ location ~* ^/(?:.*/)?(?:user|cart|checkout|logout|flag) {
}
###
### Deny bots on never cached uri without 403 response - og compatible.
### Deny bots on never cached uri - og compatible.
###
location ~* /(?:node/[0-9]+/edit|node/add|comment/reply|approve|users) {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -467,7 +467,7 @@ location ~* /(?:node/[0-9]+/edit|node/add|comment/reply|approve|users) {
###
location / {
if ( $http_user_agent ~* wget ) {
return 444;
return 403;
}
try_files $uri @cache;
}
......
......@@ -5,31 +5,31 @@
set $nocache_details "Cache";
###
### Deny crawlers without 403 response.
### Deny crawlers.
###
if ($is_crawler) {
return 444;
return 403;
}
###
### Deny not compatible request methods without 405 response.
###
if ( $request_method !~ ^(?:GET|HEAD|POST)$ ) {
return 444;
return 403;
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
if ($is_denied) {
return 444;
return 403;
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
location ~* (?:delete.+from|insert.+into|select.+from|union.+select|onload|\.php.+src|system\(.+|document\.cookie|\;|\.\.) {
return 444;
return 403;
}
###
......@@ -78,12 +78,12 @@ location = /core/cron.php {
###
### Send search to php-fpm early so searching for node.js will work.
### Deny bots on search uri without 403 response.
### Deny bots on search uri.
###
location ^~ /search {
location ~* ^/search {
if ($is_bot) {
return 444;
return 403;
}
try_files $uri @cache;
}
......@@ -94,7 +94,7 @@ location ^~ /search {
###
location ~* /(?:autocomplete|ajax|ahah)/ {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
log_not_found off;
......@@ -116,7 +116,7 @@ location ^~ /hosting {
###
location ^~ /admin {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -129,7 +129,7 @@ location ^~ /admin {
location ^~ /audio/download {
location ~* ^/audio/download/.*/.*\.(?:mp3|mp4|m4a|ogg)$ {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -138,10 +138,10 @@ location ^~ /audio/download {
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
location ~* (/\..*|settings\.php$|\.(?:git|htaccess|engine|inc|info|install|module|profile|pl|po|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)$|^(?:Entries.*|Repository|Root|Tag|Template))$ {
return 444;
return 403;
}
###
......@@ -149,15 +149,15 @@ location ~* (/\..*|settings\.php$|\.(?:git|htaccess|engine|inc|info|install|modu
###
location ~* (?:cgi-bin|vti-bin|wp-content) {
access_log off;
return 444;
return 403;
}
###
### Deny bots on some weak modules uri without 403 response.
### Deny bots on some weak modules uri.
###
location ~* (?:calendar|event|validation|aggregator|vote_up_down|captcha) {
if ($is_bot) {
return 444;
return 403;
}
try_files $uri @cache;
}
......@@ -425,11 +425,11 @@ location ~* \.xml$ {
}
###
### Deny bots on never cached uri without 403 response.
### Deny bots on never cached uri.
###
location ~* ^/(?:.*/)?(?:user|cart|checkout|logout|flag) {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -437,11 +437,11 @@ location ~* ^/(?:.*/)?(?:user|cart|checkout|logout|flag) {
}
###
### Deny bots on never cached uri without 403 response - og compatible.
### Deny bots on never cached uri - og compatible.
###
location ~* /(?:node/[0-9]+/edit|node/add|comment/reply|approve|users) {
if ($is_bot) {
return 444;
return 403;
}
access_log off;
set $nocache_details "Skip";
......@@ -453,7 +453,7 @@ location ~* /(?:node/[0-9]+/edit|node/add|comment/reply|approve|users) {
###
location / {
if ( $http_user_agent ~* wget ) {
return 444;
return 403;
}
try_files $uri @cache;
}
......
......@@ -150,7 +150,7 @@ map $request_uri $key_uri {
}
###
### Deny crawlers without 403 response.
### Deny crawlers.
###
map $http_user_agent $is_crawler {
default '';
......@@ -158,7 +158,7 @@ map $http_user_agent $is_crawler {
}
###
### Deny all known bots on some URIs without 403 response.
### Deny all known bots on some URIs.
###
map $http_user_agent $is_bot {
default '';
......@@ -166,7 +166,7 @@ map $http_user_agent $is_bot {
}
###
### Deny listed requests for security reasons without 403 response.
### Deny listed requests for security reasons.
###
map $args $is_denied {
default '';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment