mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-28 16:12:13 +00:00
fix FORCE_HTTPS
add ip_header env
This commit is contained in:
parent
0e1d40792f
commit
679512e3cc
@ -31,6 +31,12 @@ else
|
||||
ln -sf https_redirect.conf http_locations.conf
|
||||
fi
|
||||
|
||||
if [ ! -z "$LOWER_IP_HEADER" ]; then
|
||||
sed -i "s/__IP_HEADER__/\$http_$LOWER_IP_HEADER/g" api_proxy.conf;
|
||||
else
|
||||
sed -i "s/__IP_HEADER__/\$remote_addr/g" api_proxy.conf;
|
||||
fi
|
||||
|
||||
cd $APP/dist
|
||||
if [ ! -z "$STATIC_CDN_HOST" ]; then
|
||||
find . -name index.html -exec sed -i "s/link href=\/static/link href=\/\/$STATIC_CDN_HOST\/static/g" {} \;
|
||||
|
5
deploy/nginx/api_proxy.conf
Normal file
5
deploy/nginx/api_proxy.conf
Normal file
@ -0,0 +1,5 @@
|
||||
proxy_pass http://backend;
|
||||
proxy_set_header X-Real-IP __IP_HEADER__;
|
||||
proxy_set_header Host $http_host;client_max_body_size 200M;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection '';
|
@ -1,3 +1,7 @@
|
||||
location /api/judge_server_heartbeat {
|
||||
include api_proxy.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
@ -3,10 +3,7 @@ location /public {
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://backend;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
client_max_body_size 200M;
|
||||
include api_proxy.conf;
|
||||
}
|
||||
|
||||
location /data/ {
|
||||
|
Loading…
Reference in New Issue
Block a user