Skip to content

Commit d870df6

Browse files
committed
new: add subpath rewriting in frontend image
1 parent 4a9429b commit d870df6

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

deploy/docker/default.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ LOWCODER_MONGODB_EXPOSED="false"
4040
#
4141
# URL of the public User Interface
4242
LOWCODER_PUBLIC_URL="http://localhost:3000/"
43+
LOWCODER_BASE_PATH=""
4344

4445
# ID of user running services. It will own all created logs and data.
4546
LOWCODER_PUID="1000"

deploy/docker/frontend/01-update-nginx-conf.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ sed -i "s@__LOWCODER_MAX_REQUEST_SIZE__@${LOWCODER_MAX_REQUEST_SIZE:=20m}@" /etc
2222
sed -i "s@__LOWCODER_MAX_QUERY_TIMEOUT__@${LOWCODER_MAX_QUERY_TIMEOUT:=120}@" /etc/nginx/server.conf
2323
sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/server.conf
2424
sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/server.conf
25+
sed -i "s@__LOWCODER_BASE_PATH__@${LOWCODER_BASE_PATH}@" /etc/nginx/server.conf
2526

2627
echo "nginx config updated with:"
2728
echo " Lowcoder max upload size: ${LOWCODER_MAX_REQUEST_SIZE:=20m}"

deploy/docker/frontend/server.conf

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,68 @@
44
proxy_send_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
55
proxy_read_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
66

7-
location / {
7+
location __LOWCODER_BASE_PATH__/ {
88
try_files $uri /index.html;
99

1010
if ($request_filename ~* .*.(html|htm)$) {
1111
add_header Cache-Control no-cache;
1212
}
13+
14+
sub_filter "__LOWCODER_BASEPATH_PLACEHOLDER__" "__LOWCODER_BASE_PATH__";
15+
sub_filter_once off;
16+
sub_filter_types *;
1317
}
1418

15-
location /sdk {
19+
location __LOWCODER_BASE_PATH__/sdk {
1620
try_files $uri =404;
1721

1822
alias /lowcoder/client-sdk;
1923
expires 1M;
24+
25+
sub_filter "__LOWCODER_BASEPATH_PLACEHOLDER__" "__LOWCODER_BASE_PATH__";
26+
sub_filter_once off;
27+
sub_filter_types *;
2028
}
2129

22-
location /comps {
30+
location __LOWCODER_BASE_PATH__/comps {
2331
try_files $uri =404;
2432

2533
alias /lowcoder/client-comps;
2634
expires 1M;
35+
sub_filter "__LOWCODER_BASEPATH_PLACEHOLDER__" "__LOWCODER_BASE_PATH__";
36+
sub_filter_once off;
37+
sub_filter_types *;
2738
}
2839

29-
location /embed {
40+
location __LOWCODER_BASE_PATH__/embed {
3041
try_files $uri =404;
3142

3243
alias /lowcoder/client-embed;
3344
expires 1M;
45+
sub_filter "__LOWCODER_BASEPATH_PLACEHOLDER__" "__LOWCODER_BASE_PATH__";
46+
sub_filter_once off;
47+
sub_filter_types *;
3448
}
3549

36-
location /assets {
50+
location __LOWCODER_BASE_PATH__/assets {
3751
try_files $uri =404;
3852

3953
alias /lowcoder/assets;
4054
expires 1M;
55+
sub_filter "__LOWCODER_BASEPATH_PLACEHOLDER__" "__LOWCODER_BASE_PATH__";
56+
sub_filter_once off;
57+
sub_filter_types *;
4158
}
4259

43-
location /api {
60+
location __LOWCODER_BASE_PATH__/api {
4461
proxy_set_header X-Forwarded-Proto $scheme;
4562
proxy_set_header X-Forwarded-Host $host;
4663
proxy_set_header X-Forwarded-For $remote_addr;
4764
proxy_set_header X-Real-IP $remote_addr;
4865
proxy_pass __LOWCODER_API_SERVICE_URL__;
4966
}
5067

51-
location /node-service/plugin-icons {
68+
location __LOWCODER_BASE_PATH__/node-service/plugin-icons {
5269
proxy_set_header X-Forwarded-Proto $scheme;
5370
proxy_set_header X-Forwarded-Host $host;
5471
proxy_set_header X-Forwarded-For $remote_addr;

0 commit comments

Comments
 (0)