Skip to content

Commit 9a900cc

Browse files
committed
fix: normalize max request size for nginx
1 parent 9308879 commit 9a900cc

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

deploy/docker/default.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ LOWCODER_NODE_SERVICE_SECRET_SALT="lowcoder.org"
116116
##
117117
## Frontend parameters
118118
##
119-
# Lowcoder max request size
120-
LOWCODER_MAX_REQUEST_SIZE=20m
119+
# Lowcoder max request size in kb/mb/gb
120+
LOWCODER_MAX_REQUEST_SIZE=20mb
121121
# Lowcoder max query timeout (in seconds)
122122
LOWCODER_MAX_QUERY_TIMEOUT=120
123123
# Default lowcoder query timeout

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ else
1818
ln -s /etc/nginx/nginx-http.conf /etc/nginx/nginx.conf
1919
fi;
2020

21-
sed -i "s@__LOWCODER_MAX_REQUEST_SIZE__@${LOWCODER_MAX_REQUEST_SIZE:=20m}@" /etc/nginx/nginx.conf
21+
# Normalize max. request size for usage with nginx
22+
MAX_REQUEST_SIZE=$(echo "${LOWCODER_MAX_REQUEST_SIZE:=20m}" | perl -pe 's/^([ \t]*)(?<number>\d+(\.\d+)?)([ \t]*)(?<unit>[kKmMgGtT]{1})?([bB \t]*)$/"$+{number}" . lc($+{unit})/e')
23+
24+
25+
sed -i "s@__LOWCODER_MAX_REQUEST_SIZE__@${MAX_REQUEST_SIZE}@" /etc/nginx/nginx.conf
2226
sed -i "s@__LOWCODER_MAX_QUERY_TIMEOUT__@${LOWCODER_MAX_QUERY_TIMEOUT:=120}@" /etc/nginx/server.conf
2327
sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/server.conf
2428
sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/server.conf
2529

2630
echo "nginx config updated with:"
27-
echo " Lowcoder max upload size: ${LOWCODER_MAX_REQUEST_SIZE:=20m}"
31+
echo " Lowcoder max upload size: ${MAX_REQUEST_SIZE:=20m}"
2832
echo " Lowcoder api service URL: ${LOWCODER_API_SERVICE_URL:=http://localhost:8080}"
2933
echo " Lowcoder node service URL: ${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}"

deploy/helm/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ global:
3434
nodeServiceSecret: "62e348319ab9f5c43c3b5a380b4d82525cdb68740f21140e767989b509ab0aa2"
3535
nodeServiceSalt: "lowcoder.org"
3636
maxQueryTimeout: 120
37-
maxRequestSize: "20m"
37+
maxRequestSize: "20mb"
3838
snapshotRetentionTime: 30
3939
marketplacePrivateMode: true
4040
cookie:

0 commit comments

Comments
 (0)