Skip to content

Commit 01150ed

Browse files
seyhellovladfrangu
andauthored
fix: Preview Docs Environment Nginx rules (#1595)
- fix: Nginx rules change to route correctly preview documentation environment Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
1 parent 34f2966 commit 01150ed

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

nginx.conf

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,18 +446,45 @@ server {
446446

447447
server {
448448
listen 0.0.0.0:8080;
449-
449+
resolver 172.20.0.10;
450450
server_name ~^(?<subdomain>[^.]+)\.preview\.docs\.apify\.com$;
451451

452+
# add trailing slashes to the root of GH pages docs
453+
rewrite ^/api/client/js$ /api/client/js/ redirect;
454+
rewrite ^/api/client/python$ /api/client/python/ redirect;
455+
rewrite ^/sdk/js$ /sdk/js/ redirect;
456+
rewrite ^/sdk/python$ /sdk/python/ redirect;
457+
rewrite ^/cli$ /cli/ redirect;
458+
459+
location ~ ^/api/client/js/(.*)$ {
460+
proxy_pass https://apify.github.io/apify-client-js/$1;
461+
}
462+
location ~ ^/api/client/python/(.*)$ {
463+
proxy_pass https://apify.github.io/apify-client-python/$1;
464+
}
465+
location ~ ^/sdk/js/(.*)$ {
466+
proxy_pass https://apify.github.io/apify-sdk-js/$1;
467+
}
468+
location ~ ^/sdk/python/(.*)$ {
469+
proxy_pass https://apify.github.io/apify-sdk-python/$1;
470+
}
471+
location ~ ^/cli/(.*)$ {
472+
proxy_pass https://apify.github.io/apify-cli/$1;
473+
}
474+
475+
location = / {
476+
proxy_pass https://s3.amazonaws.com/apify-docs-preview/$subdomain/index.html;
477+
}
452478
location ~ ^/(.*)/$ {
453479
proxy_pass https://s3.amazonaws.com/apify-docs-preview/$subdomain/$1/index.html;
454480
}
455-
456-
location ~ ^/(.*[^./])$ {
481+
location ~ ^/([^.]+)$ {
457482
proxy_pass https://s3.amazonaws.com/apify-docs-preview/$subdomain/$1.html;
458483
}
459-
484+
location ~ ^/(.*)$ {
485+
proxy_pass https://s3.amazonaws.com/apify-docs-preview/$subdomain/$1;
486+
}
460487
location / {
461-
proxy_pass https://s3.amazonaws.com/apify-docs-preview/$subdomain/;
488+
proxy_pass https://s3.amazonaws.com/apify-docs-preview/$subdomain$uri;
462489
}
463-
}
490+
}

0 commit comments

Comments
 (0)