@@ -44,22 +44,177 @@ 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/( .*) $ {
69+ set $path_suffix $1 ;
70+ set $proxy_path "/$path_suffix" ;
71+
72+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
73+
74+ if ( $rewrite_condition = "11" ) {
75+ set $proxy_path "${proxy_path}.md" ;
76+ }
77+
78+ proxy_pass https://apify.github.io/apify-sdk-js$proxy_path ;
79+ }
80+
81+ ### Repository path: "/sdk/python"
82+
83+ location = /sdk/python {
84+ if ( $serve_markdown ) {
85+ rewrite ^ /sdk-python-llms.txt last;
86+ }
87+ proxy_pass https://apify.github.io/apify-sdk-python/;
88+ }
89+ location = /sdk/python/ {
90+ if ( $serve_markdown ) {
91+ rewrite ^ /sdk-python-llms.txt last;
92+ }
93+ proxy_pass https://apify.github.io/apify-sdk-python/;
94+ }
95+
96+ location = /sdk-python-llms.txt {
97+ proxy_hide_header Content-Type;
98+ add_header Content-Type 'text/markdown; charset=utf-8' always;
99+ proxy_pass https://apify.github.io/apify-sdk-python/llms.txt;
100+ }
101+
102+ location ~ ^/sdk/python/( .*) $ {
103+ set $path_suffix $1 ;
104+ set $proxy_path "/$path_suffix" ;
105+
106+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
107+
108+ if ( $rewrite_condition = "11" ) {
109+ set $proxy_path "${proxy_path}.md" ;
110+ }
111+
112+ proxy_pass https://apify.github.io/apify-sdk-python$proxy_path ;
113+ }
114+
115+ ### Repository path: "/api/client/js"
116+
117+ location = /api/client/js {
118+ if ( $serve_markdown ) {
119+ rewrite ^ /client-js-llms.txt last;
120+ }
121+ proxy_pass https://apify.github.io/apify-client-js/;
122+ }
123+ location = /api/client/js/ {
124+ if ( $serve_markdown ) {
125+ rewrite ^ /client-js-llms.txt last;
126+ }
49127 proxy_pass https://apify.github.io/apify-client-js/;
50128 }
51- location /api/client/python {
129+
130+ location = /client-js-llms.txt {
131+ proxy_hide_header Content-Type;
132+ add_header Content-Type 'text/markdown; charset=utf-8' always;
133+ proxy_pass https://apify.github.io/apify-client-js/llms.txt;
134+ }
135+
136+ location ~ ^/api/client/js/( .*) $ {
137+ set $path_suffix $1 ;
138+ set $proxy_path "/$path_suffix" ;
139+
140+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
141+
142+ if ( $rewrite_condition = "11" ) {
143+ set $proxy_path "${proxy_path}.md" ;
144+ }
145+
146+ proxy_pass https://apify.github.io/apify-client-js$proxy_path ;
147+ }
148+
149+ ### Repository path: "/api/client/python"
150+
151+ location = /api/client/python {
152+ if ( $serve_markdown ) {
153+ rewrite ^ /client-python-llms.txt last;
154+ }
52155 proxy_pass https://apify.github.io/apify-client-python/;
53156 }
54- location /sdk/js {
55- proxy_pass https://apify.github.io/apify-sdk-js/;
157+ location = /api/client/python/ {
158+ if ( $serve_markdown ) {
159+ rewrite ^ /client-python-llms.txt last;
160+ }
161+ proxy_pass https://apify.github.io/apify-client-python/;
56162 }
57- location /sdk/python {
58- proxy_pass https://apify.github.io/apify-sdk-python/;
163+
164+ location = /client-python-llms.txt {
165+ proxy_hide_header Content-Type;
166+ add_header Content-Type 'text/markdown; charset=utf-8' always;
167+ proxy_pass https://apify.github.io/apify-client-python/llms.txt;
168+ }
169+
170+ location ~ ^/api/client/python {
171+ set $path_suffix $1 ;
172+ set $proxy_path "/$path_suffix" ;
173+
174+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
175+
176+ if ( $rewrite_condition = "11" ) {
177+ set $proxy_path "${proxy_path}.md" ;
178+ }
179+
180+ proxy_pass https://apify.github.io/apify-client-python$proxy_path ;
181+ }
182+
183+
184+ ### Repository path: "/cli"
185+
186+ location = /cli {
187+ if ( $serve_markdown ) {
188+ rewrite ^ /cli-llms.txt last;
189+ }
190+ proxy_pass https://apify.github.io/apify-cli/;
59191 }
60- location /cli {
192+ location = /cli/ {
193+ if ( $serve_markdown ) {
194+ rewrite ^ /cli-llms.txt last;
195+ }
61196 proxy_pass https://apify.github.io/apify-cli/;
62197 }
198+
199+ location = /cli-llms.txt {
200+ proxy_hide_header Content-Type;
201+ add_header Content-Type 'text/markdown; charset=utf-8' always;
202+ proxy_pass https://apify.github.io/apify-cli/llms.txt;
203+ }
204+
205+ location ~ ^/cli/( .*) $ {
206+ set $path_suffix $1 ;
207+ set $proxy_path "/$path_suffix" ;
208+
209+ set $rewrite_condition "$serve_markdown$has_no_extension" ;
210+
211+ if ( $rewrite_condition = "11" ) {
212+ set $proxy_path "${proxy_path}.md" ;
213+ }
214+
215+ proxy_pass https://apify.github.io/apify-cli$proxy_path ;
216+ }
217+
63218 location = /health {
64219 access_log off;
65220 add_header 'Content-Type' 'application/json' ;
@@ -260,16 +415,16 @@ server {
260415 rewrite ^/sdk/js/docs/typedefs( .*) $ /sdk/js/docs/2.3/typedefs$1 redirect;
261416
262417 # 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;
418+ rewrite ^/apify-client-js/?$ /api/client/js redirect;
419+ rewrite ^/apify-client-js/latest/?$ /api/client/js redirect;
420+ rewrite ^/apify-client-python/?$ /api/client/python redirect;
421+
422+ # remove trailing slashes from the root of GH pages docs
423+ rewrite ^/api/client/js/ $ /api/client/js redirect;
424+ rewrite ^/api/client/python/ $ /api/client/python redirect;
425+ rewrite ^/sdk/js/ $ /sdk/js redirect;
426+ rewrite ^/sdk/python/ $ /sdk/python redirect;
427+ rewrite ^/cli/ $ /cli redirect;
273428
274429 # versions page redirects
275430 rewrite ^/versions/?$ / permanent; # no docs-wide changelog, redirect to the root
0 commit comments