Skip to content

Commit 28780dd

Browse files
authored
fix: revert nginx config back (#2011)
Related: #1997
1 parent 49e6c36 commit 28780dd

File tree

1 file changed

+3
-64
lines changed

1 file changed

+3
-64
lines changed

nginx.conf

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,12 @@
1-
# Map Accept headers to Markdown flag
2-
map $http_accept $wants_markdown {
3-
default 0;
4-
"~*text/markdown" 1;
5-
"~*text/plain" 1;
6-
}
7-
8-
# Define named upstream for local dev
9-
upstream local_docs {
10-
server 127.0.0.1:3000;
11-
}
12-
13-
# Map host to upstream
14-
map $host $docs_upstream {
15-
"docs.apify.com" https://apify.github.io/apify-docs; # production
16-
default http://local_docs; # local dev
17-
}
18-
191
server {
202
listen 0.0.0.0:8080;
21-
server_name docs.apify.loc docs.apify.com;
3+
server_name docs.apify.com;
224

23-
# Homepage: llms.txt fallback
245
location = / {
25-
if ($wants_markdown) {
26-
rewrite ^ /__proxy/llms.txt last;
27-
}
28-
proxy_pass $docs_upstream;
29-
proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/;
30-
}
31-
32-
# Direct llms.txt files
33-
location = /llms.txt {
34-
proxy_pass $docs_upstream/llms.txt;
35-
proxy_hide_header Content-Type;
36-
add_header Content-Type "text/markdown; charset=utf-8" always;
37-
proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/;
38-
}
39-
40-
location = /llms-full.txt {
41-
proxy_pass $docs_upstream/llms-full.txt;
42-
proxy_hide_header Content-Type;
43-
add_header Content-Type "text/markdown; charset=utf-8" always;
44-
proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/;
45-
}
46-
47-
# Generic Markdown fallback for all URLs
48-
location / {
49-
if ($wants_markdown) {
50-
# rewrite clean URLs or URLs ending in .md to internal proxy
51-
rewrite ^(/.*\.md)$ /__proxy$1 last; # already .md
52-
rewrite ^(/.*[^/.])$ /__proxy$1.md last; # no extension
53-
}
54-
proxy_pass $docs_upstream;
55-
proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/;
56-
}
57-
58-
# Internal proxy for Markdown handling
59-
location ^~ /__proxy/ {
60-
internal;
61-
rewrite ^/__proxy/(.*)$ /$1 break;
62-
63-
proxy_pass $docs_upstream;
64-
proxy_hide_header Content-Type;
65-
add_header Content-Type "text/markdown; charset=utf-8" always;
66-
67-
proxy_redirect https://apify.github.io/ https://apify.github.io/apify-docs/;
6+
proxy_pass https://apify.github.io/apify-docs/;
687
}
698

70-
# proxies to other repositories
9+
# proxies to other repositories
7110
location /api/client/js {
7211
proxy_pass https://apify.github.io/apify-client-js/;
7312
}

0 commit comments

Comments
 (0)