From 4ffca089b569937ec1d523cb1e344e9c80f2a780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ad=C3=A1mek?= Date: Tue, 14 Oct 2025 17:38:31 +0200 Subject: [PATCH] fix: revert nginx config back Related: #1997 --- nginx.conf | 67 +++--------------------------------------------------- 1 file changed, 3 insertions(+), 64 deletions(-) diff --git a/nginx.conf b/nginx.conf index 2a70ef8d3..779bcbb4c 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,73 +1,12 @@ -# Map Accept headers to Markdown flag -map $http_accept $wants_markdown { - default 0; - "~*text/markdown" 1; - "~*text/plain" 1; -} - -# Define named upstream for local dev -upstream local_docs { - server 127.0.0.1:3000; -} - -# Map host to upstream -map $host $docs_upstream { - "docs.apify.com" https://apify.github.io/apify-docs; # production - default http://local_docs; # local dev -} - server { listen 0.0.0.0:8080; - server_name docs.apify.loc docs.apify.com; + server_name docs.apify.com; - # Homepage: llms.txt fallback location = / { - if ($wants_markdown) { - rewrite ^ /__proxy/llms.txt last; - } - proxy_pass $docs_upstream; - proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/; - } - - # Direct llms.txt files - location = /llms.txt { - proxy_pass $docs_upstream/llms.txt; - proxy_hide_header Content-Type; - add_header Content-Type "text/markdown; charset=utf-8" always; - proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/; - } - - location = /llms-full.txt { - proxy_pass $docs_upstream/llms-full.txt; - proxy_hide_header Content-Type; - add_header Content-Type "text/markdown; charset=utf-8" always; - proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/; - } - - # Generic Markdown fallback for all URLs - location / { - if ($wants_markdown) { - # rewrite clean URLs or URLs ending in .md to internal proxy - rewrite ^(/.*\.md)$ /__proxy$1 last; # already .md - rewrite ^(/.*[^/.])$ /__proxy$1.md last; # no extension - } - proxy_pass $docs_upstream; - proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/; - } - - # Internal proxy for Markdown handling - location ^~ /__proxy/ { - internal; - rewrite ^/__proxy/(.*)$ /$1 break; - - proxy_pass $docs_upstream; - proxy_hide_header Content-Type; - add_header Content-Type "text/markdown; charset=utf-8" always; - - proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/; + proxy_pass https://apify.github.io/apify-docs/; } - # proxies to other repositories + # proxies to other repositories location /api/client/js { proxy_pass https://apify.github.io/apify-client-js/; }