diff --git a/nginx/sites-available/cloud.grupopralog.com.br.conf b/nginx/sites-available/cloud.grupopralog.com.br.conf index 5010140..3ff7b4b 100644 --- a/nginx/sites-available/cloud.grupopralog.com.br.conf +++ b/nginx/sites-available/cloud.grupopralog.com.br.conf @@ -267,15 +267,15 @@ server { proxy_buffering on; # Buffering é bom para pequenas respostas de API } - location ~ ^/(ocs/v[12].php/cloud/users|ocs/v[12].php/privatedata/get|ocs/v2.php/apps/notifications/api/v2/notifications) { + location ~ ^/(ocs/v[12].php/cloud/users|ocs/v[12].php/privatedata/get|ocs/v2.php/apps/notifications/api/v2/notifications|ocs/v[12].php/cloud/apps|ocs/v[12].php/cloud/user|ocs/v[12].php/privatedata/get/userinfo) { # Usar a mesma configuração de cache proxy_cache nextcloud_cache; # Usar a mesma chave segura: host + URI + ID da Sessão proxy_cache_key "$host$request_uri|$cookie_nc_session_id"; - # Cache muito curto (1 segundo) para evitar vazamento e garantir frescor - proxy_cache_valid 200 1s; + # Cache muito curto (5 segundo) para evitar vazamento e garantir frescor + proxy_cache_valid 200 5s; # Tratar erros e timeouts proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; @@ -294,35 +294,6 @@ server { proxy_buffering on; } - # --- Micro-caching Otimizado para APIs Nextcloud de montagem de Interface --- - location ~ ^/(ocs/v[12].php/cloud/apps|ocs/v[12].php/privatedata/get|ocs/v2.php/apps/notifications/api/v2/notifications|ocs/v[12].php/cloud/user|ocs/v[12].php/privatedata/get/userinfo) { - proxy_cache nextcloud_cache; - - # Chave Segura com ID da Sessão, focando no que é essencial - proxy_cache_key "$host$request_uri|$cookie_nc_session_id"; - - # Cache muito curto (1 a 5 segundos) - proxy_cache_valid 200 5s; - - # Bloqueio de Cache para métodos que alteram dados - if ($request_method = POST) { - proxy_cache_bypass 1; - } - - proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; - add_header X-APIMicroCache-Status $upstream_cache_status; - - # Configurações de Proxy - proxy_pass http://nextcloud_backend; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_buffering on; - } - # --- Rota Principal da Aplicação Nextcloud --- location / { # --- CORREÇÃO: Lógica de Cache de Sessão ---