@@ -44,22 +44,211 @@ server {
4444 proxy_pass $backend$proxy_path ;
4545 }
4646
47- # proxies to other repositories
48- location /api/client/js {
47+ ### Repository path: "/sdk/js"
48+
49+ location = /sdk/js {
50+ if ( $serve_markdown ) {
51+ rewrite ^ /sdk-js-llms.txt last;
52+ }
53+ proxy_pass https://apify.github.io/apify-sdk-js/;
54+ }
55+ location = /sdk/js/ {
56+ if ( $serve_markdown ) {
57+ rewrite ^ /sdk-js-llms.txt last;
58+ }
59+ proxy_pass https://apify.github.io/apify-sdk-js/;
60+ }
61+
62+ location = /sdk-js-llms.txt {
63+ proxy_hide_header Content-Type;
64+ add_header Content-Type 'text/markdown; charset=utf-8' always;
65+ proxy_pass https://apify.github.io/apify-sdk-js/llms.txt;
66+ }
67+
68+ location ~ ^/sdk/js/( llms|llms-full) \.txt$ {
69+ rewrite ^/sdk/js( /.*) $ $1 break ;
70+ proxy_hide_header Content-Type;
71+ add_header Content-Type 'text/markdown; charset=utf-8' always;
72+ proxy_pass https://apify.github.io/apify-sdk-js$uri ;
73+ }
74+
75+ location ~ ^/sdk/js/( .*) $ {
76+ set $path_suffix $1 ;
77+ set $proxy_path "/$path_suffix" ;
78+
79+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
80+
81+ if ( $rewrite_condition = "11" ) {
82+ set $proxy_path "${proxy_path}.md" ;
83+ }
84+
85+ proxy_pass https://apify.github.io/apify-sdk-js$proxy_path ;
86+ }
87+
88+ ### Repository path: "/sdk/python"
89+
90+ location = /sdk/python {
91+ if ( $serve_markdown ) {
92+ rewrite ^ /sdk-python-llms.txt last;
93+ }
94+ proxy_pass https://apify.github.io/apify-sdk-python/;
95+ }
96+ location = /sdk/python/ {
97+ if ( $serve_markdown ) {
98+ rewrite ^ /sdk-python-llms.txt last;
99+ }
100+ proxy_pass https://apify.github.io/apify-sdk-python/;
101+ }
102+
103+ location = /sdk-python-llms.txt {
104+ proxy_hide_header Content-Type;
105+ add_header Content-Type 'text/markdown; charset=utf-8' always;
106+ proxy_pass https://apify.github.io/apify-sdk-python/llms.txt;
107+ }
108+
109+ location ~ ^/sdk/python/( llms|llms-full) \.txt$ {
110+ rewrite ^/sdk/python( /.*) $ $1 break ;
111+ proxy_hide_header Content-Type;
112+ add_header Content-Type 'text/markdown; charset=utf-8' always;
113+ proxy_pass https://apify.github.io/apify-sdk-python$uri ;
114+ }
115+
116+ location ~ ^/sdk/python/( .*) $ {
117+ set $path_suffix $1 ;
118+ set $proxy_path "/$path_suffix" ;
119+
120+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
121+
122+ if ( $rewrite_condition = "11" ) {
123+ set $proxy_path "${proxy_path}.md" ;
124+ }
125+
126+ proxy_pass https://apify.github.io/apify-sdk-python$proxy_path ;
127+ }
128+
129+ ### Repository path: "/api/client/js"
130+
131+ location = /api/client/js {
132+ if ( $serve_markdown ) {
133+ rewrite ^ /client-js-llms.txt last;
134+ }
49135 proxy_pass https://apify.github.io/apify-client-js/;
50136 }
51- location /api/client/python {
137+ location = /api/client/js/ {
138+ if ( $serve_markdown ) {
139+ rewrite ^ /client-js-llms.txt last;
140+ }
141+ proxy_pass https://apify.github.io/apify-client-js/;
142+ }
143+
144+ location = /client-js-llms.txt {
145+ proxy_hide_header Content-Type;
146+ add_header Content-Type 'text/markdown; charset=utf-8' always;
147+ proxy_pass https://apify.github.io/apify-client-js/llms.txt;
148+ }
149+
150+ location ~ ^/api/client/js/( llms|llms-full) \.txt$ {
151+ rewrite ^/api/client/js( /.*) $ $1 break ;
152+ proxy_hide_header Content-Type;
153+ add_header Content-Type 'text/markdown; charset=utf-8' always;
154+ proxy_pass https://apify.github.io/apify-client-js$uri ;
155+ }
156+
157+ location ~ ^/api/client/js/( .*) $ {
158+ set $path_suffix $1 ;
159+ set $proxy_path "/$path_suffix" ;
160+
161+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
162+
163+ if ( $rewrite_condition = "11" ) {
164+ set $proxy_path "${proxy_path}.md" ;
165+ }
166+
167+ proxy_pass https://apify.github.io/apify-client-js$proxy_path ;
168+ }
169+
170+ ### Repository path: "/api/client/python"
171+
172+ location = /api/client/python {
173+ if ( $serve_markdown ) {
174+ rewrite ^ /client-python-llms.txt last;
175+ }
52176 proxy_pass https://apify.github.io/apify-client-python/;
53177 }
54- location /sdk/js {
55- proxy_pass https://apify.github.io/apify-sdk-js/;
178+ location = /api/client/python/ {
179+ if ( $serve_markdown ) {
180+ rewrite ^ /client-python-llms.txt last;
181+ }
182+ proxy_pass https://apify.github.io/apify-client-python/;
56183 }
57- location /sdk/python {
58- proxy_pass https://apify.github.io/apify-sdk-python/;
184+
185+ location = /client-python-llms.txt {
186+ proxy_hide_header Content-Type;
187+ add_header Content-Type 'text/markdown; charset=utf-8' always;
188+ proxy_pass https://apify.github.io/apify-client-python/llms.txt;
189+ }
190+
191+ location ~ ^/api/client/python/( llms|llms-full) \.txt$ {
192+ rewrite ^/api/client/python( /.*) $ $1 break ;
193+ proxy_hide_header Content-Type;
194+ add_header Content-Type 'text/markdown; charset=utf-8' always;
195+ proxy_pass https://apify.github.io/apify-client-python$uri ;
196+ }
197+
198+ location ~ ^/api/client/python/( .*) $ {
199+ set $path_suffix $1 ;
200+ set $proxy_path "/$path_suffix" ;
201+
202+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
203+
204+ if ( $rewrite_condition = "11" ) {
205+ set $proxy_path "${proxy_path}.md" ;
206+ }
207+
208+ proxy_pass https://apify.github.io/apify-client-python$proxy_path ;
59209 }
60- location /cli {
210+
211+ ### Repository path: "/cli"
212+
213+ location = /cli {
214+ if ( $serve_markdown ) {
215+ rewrite ^ /cli-llms.txt last;
216+ }
217+ proxy_pass https://apify.github.io/apify-cli/;
218+ }
219+ location = /cli/ {
220+ if ( $serve_markdown ) {
221+ rewrite ^ /cli-llms.txt last;
222+ }
61223 proxy_pass https://apify.github.io/apify-cli/;
62224 }
225+
226+ location = /cli-llms.txt {
227+ proxy_hide_header Content-Type;
228+ add_header Content-Type 'text/markdown; charset=utf-8' always;
229+ proxy_pass https://apify.github.io/apify-cli/llms.txt;
230+ }
231+
232+ location ~ ^/cli/( llms|llms-full) \.txt$ {
233+ rewrite ^/cli( /.*) $ $1 break ;
234+ proxy_hide_header Content-Type;
235+ add_header Content-Type 'text/markdown; charset=utf-8' always;
236+ proxy_pass https://apify.github.io/apify-cli$uri ;
237+ }
238+
239+ location ~ ^/cli/( .*) $ {
240+ set $path_suffix $1 ;
241+ set $proxy_path "/$path_suffix" ;
242+
243+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
244+
245+ if ( $rewrite_condition = "11" ) {
246+ set $proxy_path "${proxy_path}.md" ;
247+ }
248+
249+ proxy_pass https://apify.github.io/apify-cli$proxy_path ;
250+ }
251+
63252 location = /health {
64253 access_log off;
65254 add_header 'Content-Type' 'application/json' ;
@@ -260,16 +449,16 @@ server {
260449 rewrite ^/sdk/js/docs/typedefs( .*) $ /sdk/js/docs/2.3/typedefs$1 redirect;
261450
262451 # old integrated docs -> new docs in GH pages
263- rewrite ^/apify-client-js/?$ /api/client/js/ redirect;
264- rewrite ^/apify-client-js/latest/?$ /api/client/js/ redirect;
265- rewrite ^/apify-client-python/?$ /api/client/python/ redirect;
266-
267- # add trailing slashes to the root of GH pages docs
268- rewrite ^/api/client/js$ /api/client/js/ redirect;
269- rewrite ^/api/client/python$ /api/client/python/ redirect;
270- rewrite ^/sdk/js$ /sdk/js/ redirect;
271- rewrite ^/sdk/python$ /sdk/python/ redirect;
272- rewrite ^/cli$ /cli/ redirect;
452+ rewrite ^/apify-client-js/?$ /api/client/js redirect;
453+ rewrite ^/apify-client-js/latest/?$ /api/client/js redirect;
454+ rewrite ^/apify-client-python/?$ /api/client/python redirect;
455+
456+ # remove trailing slashes from the root of GH pages docs
457+ rewrite ^/api/client/js/ $ /api/client/js redirect;
458+ rewrite ^/api/client/python/ $ /api/client/python redirect;
459+ rewrite ^/sdk/js/ $ /sdk/js redirect;
460+ rewrite ^/sdk/python/ $ /sdk/python redirect;
461+ rewrite ^/cli/ $ /cli redirect;
273462
274463 # versions page redirects
275464 rewrite ^/versions/?$ / permanent; # no docs-wide changelog, redirect to the root
0 commit comments