From 396bda5977b7569c06c2d27f3436f69786d6bde6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Toledo?= Date: Wed, 4 Feb 2026 19:29:12 -0300 Subject: [PATCH] refactor: Especializa snippets well-known (robots, ads, security) --- snippets/ads.txt.conf | 13 ------------- snippets/ads_disallow.conf | 8 ++++++++ snippets/humans.txt.conf | 7 +------ snippets/robots.txt.conf | 16 ---------------- snippets/robots_allow.conf | 8 ++++++++ snippets/robots_disallow.conf | 8 ++++++++ snippets/security.txt.conf | 7 +------ snippets/well_known.conf | 4 ++-- 8 files changed, 28 insertions(+), 43 deletions(-) delete mode 100644 snippets/ads.txt.conf create mode 100644 snippets/ads_disallow.conf delete mode 100644 snippets/robots.txt.conf create mode 100644 snippets/robots_allow.conf create mode 100644 snippets/robots_disallow.conf diff --git a/snippets/ads.txt.conf b/snippets/ads.txt.conf deleted file mode 100644 index dced4c4..0000000 --- a/snippets/ads.txt.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Ads.txt - Vendedores Autorizados de Anúncios -# Função: Lista quem está autorizado a vender o inventário de anúncios do site para evitar fraudes. -location = /ads.txt { - allow all; - log_not_found off; - access_log off; - try_files /ads.txt @proxy_ads; -} - -location @proxy_ads { - include snippets/proxy_params.conf; - proxy_pass $upstream_proto://$upstream_app; -} diff --git a/snippets/ads_disallow.conf b/snippets/ads_disallow.conf new file mode 100644 index 0000000..aa90637 --- /dev/null +++ b/snippets/ads_disallow.conf @@ -0,0 +1,8 @@ +# ads_disallow.conf - Bloquear Todos os Vendedores de Anúncios +# Função: Indica que nenhum vendedor está autorizado, prevenindo anúncios não autorizados. +location = /ads.txt { + allow all; + log_not_found off; + access_log off; + return 200 "contact=suporte@itguys.com.br\n"; +} diff --git a/snippets/humans.txt.conf b/snippets/humans.txt.conf index 2dbf0ba..fb3e3af 100644 --- a/snippets/humans.txt.conf +++ b/snippets/humans.txt.conf @@ -4,10 +4,5 @@ location = /humans.txt { allow all; log_not_found off; access_log off; - try_files /humans.txt @proxy_humans; -} - -location @proxy_humans { - include snippets/proxy_params.conf; - proxy_pass $upstream_proto://$upstream_app; + try_files /humans.txt =404; } diff --git a/snippets/robots.txt.conf b/snippets/robots.txt.conf deleted file mode 100644 index c5ba7fc..0000000 --- a/snippets/robots.txt.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Robots.txt - Controle de Crawler -# Função: Indica para robôs (Google, Bing, IA) o que pode ou não ser indexado. -location = /robots.txt { - allow all; - log_not_found off; - access_log off; - # Exemplo de conteúdo direto (opcional): - # return 200 "User-agent: *\nDisallow: /admin/\nSitemap: $scheme://$host/sitemap.xml"; - try_files /robots.txt @proxy_robots; -} - -location @proxy_robots { - # Caso não exista no proxy, tenta buscar no backend - include snippets/proxy_params.conf; - proxy_pass $upstream_proto://$upstream_app; -} diff --git a/snippets/robots_allow.conf b/snippets/robots_allow.conf new file mode 100644 index 0000000..dd0bc7b --- /dev/null +++ b/snippets/robots_allow.conf @@ -0,0 +1,8 @@ +# robots_allow.conf - Permitir Tudo +# Função: Indica que todos os robôs podem indexar todo o site. +location = /robots.txt { + allow all; + log_not_found off; + access_log off; + return 200 "User-agent: *\nAllow: /\n"; +} diff --git a/snippets/robots_disallow.conf b/snippets/robots_disallow.conf new file mode 100644 index 0000000..30c5654 --- /dev/null +++ b/snippets/robots_disallow.conf @@ -0,0 +1,8 @@ +# robots_disallow.conf - Bloquear Tudo +# Função: Indica que nenhum robô deve indexar o site. +location = /robots.txt { + allow all; + log_not_found off; + access_log off; + return 200 "User-agent: *\nDisallow: /\n"; +} diff --git a/snippets/security.txt.conf b/snippets/security.txt.conf index c367a31..1c3fbaf 100644 --- a/snippets/security.txt.conf +++ b/snippets/security.txt.conf @@ -4,10 +4,5 @@ location = /.well-known/security.txt { allow all; log_not_found off; access_log off; - try_files /.well-known/security.txt /security.txt @proxy_security; -} - -location @proxy_security { - include snippets/proxy_params.conf; - proxy_pass $upstream_proto://$upstream_app; + return 200 "Contact: mailto:suporte@itguys.com.br\nPreferred-Languages: pt, en\n"; } diff --git a/snippets/well_known.conf b/snippets/well_known.conf index 79e83f9..4db5b3b 100644 --- a/snippets/well_known.conf +++ b/snippets/well_known.conf @@ -1,7 +1,7 @@ # Agregador de Arquivos de Identificação e Controle (Well-Known / Root Files) # Função: Inclui todos os snippets padrão de identificação em um único comando. -include snippets/robots.txt.conf; +include snippets/robots_disallow.conf; include snippets/security.txt.conf; include snippets/humans.txt.conf; -include snippets/ads.txt.conf; +include snippets/ads_disallow.conf;