Skip to content

Commit 5245af9

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

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
include $(pwd)/nginx.conf;
5959
}
6060
EOF
61+
export DOCS_PROXY_TARGET=http://localhost:3000
6162
mkdir -p $(pwd)/logs
6263
nginx -c $(pwd)/default.conf
6364
sleep 1

nginx.conf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
env DOCS_PROXY_TARGET;
2+
3+
map $DOCS_PROXY_TARGET $proxy_target {
4+
default "https://apify.github.io/apify-docs/";
5+
"" "https://apify.github.io/apify-docs/";
6+
"~^http" $DOCS_PROXY_TARGET;
7+
}
18
map $http_accept $wants_markdown {
29
default 0;
310
"~*text/markdown" 1;
@@ -14,12 +21,12 @@ server {
1421
# use 'last' to force a new location lookup so /__proxy/ handler runs
1522
rewrite ^ /__proxy/llms.txt last;
1623
}
17-
proxy_pass http://localhost:3000;
24+
proxy_pass $DOCS_PROXY_TARGET;
1825
}
1926

2027
# direct llms.txt files, serve with markdown content type
2128
location ~ ^/llms(-full)?\.txt$ {
22-
proxy_pass http://localhost:3000;
29+
proxy_pass $DOCS_PROXY_TARGET;
2330
proxy_hide_header Content-Type;
2431
add_header Content-Type "text/markdown; charset=utf-8" always;
2532
}
@@ -30,7 +37,7 @@ server {
3037
# rewrite to internal proxy path; use last so new location is matched
3138
rewrite ^(/[^.]+)$ /__proxy$1.md last;
3239
}
33-
proxy_pass http://localhost:3000;
40+
proxy_pass $DOCS_PROXY_TARGET;
3441
}
3542

3643
# internal proxy handler that actually forces the markdown header
@@ -40,7 +47,7 @@ server {
4047
# strip the /__proxy prefix so upstream sees the real path
4148
rewrite ^/__proxy(/.*)$ $1 break;
4249

43-
proxy_pass http://localhost:3000;
50+
proxy_pass $DOCS_PROXY_TARGET;
4451
proxy_hide_header Content-Type;
4552
add_header Content-Type "text/markdown; charset=utf-8" always;
4653
}

0 commit comments

Comments
 (0)