fix FORCE_HTTPS

add ip_header env
This commit is contained in:
virusdefender 2018-01-05 09:50:25 +08:00
parent 0e1d40792f
commit 679512e3cc
4 changed files with 16 additions and 4 deletions

View File

@ -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" {} \;

View 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 '';

View File

@ -1,3 +1,7 @@
location /api/judge_server_heartbeat {
include api_proxy.conf;
}
location / {
return 301 https://$host$request_uri;
}

View File

@ -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/ {