Skip to content

Commit 6825b4a

Browse files
committed
fix: use production URL for proxy pass
Related: #1997
1 parent a712db3 commit 6825b4a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ jobs:
5858
include $(pwd)/nginx.conf;
5959
}
6060
EOF
61+
export DOCS_PROXY_TARGET=http://localhost:3000
6162
mkdir -p $(pwd)/logs
62-
nginx -c $(pwd)/default.conf
63+
nginx -c $(pwd)/default.conf -g "env DOCS_PROXY_TARGET;"
6364
sleep 1
6465
6566
- name: Run header assertions

nginx.conf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
map $DOCS_PROXY_TARGET $proxy_target {
2+
default "https://apify.github.io/apify-docs/";
3+
"" "https://apify.github.io/apify-docs/";
4+
"~^http" $DOCS_PROXY_TARGET;
5+
}
16
map $http_accept $wants_markdown {
27
default 0;
38
"~*text/markdown" 1;
@@ -14,12 +19,12 @@ server {
1419
# use 'last' to force a new location lookup so /__proxy/ handler runs
1520
rewrite ^ /__proxy/llms.txt last;
1621
}
17-
proxy_pass http://localhost:3000;
22+
proxy_pass $DOCS_PROXY_TARGET;
1823
}
1924

2025
# direct llms.txt files, serve with markdown content type
2126
location ~ ^/llms(-full)?\.txt$ {
22-
proxy_pass http://localhost:3000;
27+
proxy_pass $DOCS_PROXY_TARGET;
2328
proxy_hide_header Content-Type;
2429
add_header Content-Type "text/markdown; charset=utf-8" always;
2530
}
@@ -30,7 +35,7 @@ server {
3035
# rewrite to internal proxy path; use last so new location is matched
3136
rewrite ^(/[^.]+)$ /__proxy$1.md last;
3237
}
33-
proxy_pass http://localhost:3000;
38+
proxy_pass $DOCS_PROXY_TARGET;
3439
}
3540

3641
# internal proxy handler that actually forces the markdown header
@@ -40,7 +45,7 @@ server {
4045
# strip the /__proxy prefix so upstream sees the real path
4146
rewrite ^/__proxy(/.*)$ $1 break;
4247

43-
proxy_pass http://localhost:3000;
48+
proxy_pass $DOCS_PROXY_TARGET;
4449
proxy_hide_header Content-Type;
4550
add_header Content-Type "text/markdown; charset=utf-8" always;
4651
}

0 commit comments

Comments
 (0)