mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-09 23:00:56 +00:00
feat: Add Site name and Host as env variables for NGINX config template
This commit is contained in:
parent
d91d472c04
commit
c2ea3feae4
@ -43,9 +43,9 @@ server {
|
|||||||
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header X-Frappe-Site-Name $host;
|
|
||||||
proxy_set_header Origin $proxy_x_forwarded_proto://$http_host;
|
proxy_set_header Origin $proxy_x_forwarded_proto://$http_host;
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header X-Frappe-Site-Name ${FRAPPE_SITE_NAME_HEADER};
|
||||||
|
proxy_set_header Host ${HTTP_HOST};
|
||||||
|
|
||||||
proxy_pass http://socketio-server;
|
proxy_pass http://socketio-server;
|
||||||
}
|
}
|
||||||
@ -66,8 +66,8 @@ server {
|
|||||||
location @webserver {
|
location @webserver {
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
||||||
proxy_set_header X-Frappe-Site-Name $host;
|
proxy_set_header X-Frappe-Site-Name ${FRAPPE_SITE_NAME_HEADER};
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host ${HTTP_HOST};
|
||||||
proxy_set_header X-Use-X-Accel-Redirect True;
|
proxy_set_header X-Use-X-Accel-Redirect True;
|
||||||
proxy_read_timeout ${HTTP_TIMEOUT};
|
proxy_read_timeout ${HTTP_TIMEOUT};
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
@ -45,6 +45,15 @@ if [[ -z "$UPSTREAM_REAL_IP_HEADER" ]]; then
|
|||||||
export UPSTREAM_REAL_IP_HEADER="X-Forwarded-For"
|
export UPSTREAM_REAL_IP_HEADER="X-Forwarded-For"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$FRAPPE_SITE_NAME_HEADER" ]]; then
|
||||||
|
export FRAPPE_SITE_NAME_HEADER="\$host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$HTTP_HOST" ]]; then
|
||||||
|
export HTTP_HOST="\$http_host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
envsubst '${FRAPPE_PY}
|
envsubst '${FRAPPE_PY}
|
||||||
${FRAPPE_PY_PORT}
|
${FRAPPE_PY_PORT}
|
||||||
${FRAPPE_SOCKETIO}
|
${FRAPPE_SOCKETIO}
|
||||||
@ -52,6 +61,8 @@ envsubst '${FRAPPE_PY}
|
|||||||
${HTTP_TIMEOUT}
|
${HTTP_TIMEOUT}
|
||||||
${UPSTREAM_REAL_IP_ADDRESS}
|
${UPSTREAM_REAL_IP_ADDRESS}
|
||||||
${UPSTREAM_REAL_IP_RECURSIVE}
|
${UPSTREAM_REAL_IP_RECURSIVE}
|
||||||
|
${FRAPPE_SITE_NAME_HEADER}
|
||||||
|
${HTTP_HOST}
|
||||||
${UPSTREAM_REAL_IP_HEADER}' \
|
${UPSTREAM_REAL_IP_HEADER}' \
|
||||||
< /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
< /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ These variables are set on every container start. Change in these variables will
|
|||||||
- `UPSTREAM_REAL_IP_ADDRESS `: The trusted address (or ip range) of upstream proxy servers. If set, this will tell nginx to trust the X-Forwarded-For header from these proxy servers in determining the real IP address of connecting clients. Default: 127.0.0.1
|
- `UPSTREAM_REAL_IP_ADDRESS `: The trusted address (or ip range) of upstream proxy servers. If set, this will tell nginx to trust the X-Forwarded-For header from these proxy servers in determining the real IP address of connecting clients. Default: 127.0.0.1
|
||||||
- `UPSTREAM_REAL_IP_RECURSIVE`: When set to `on`, this will tell nginx to not just look to the last upstream proxy server in determining the real IP address. Default: off
|
- `UPSTREAM_REAL_IP_RECURSIVE`: When set to `on`, this will tell nginx to not just look to the last upstream proxy server in determining the real IP address. Default: off
|
||||||
- `UPSTREAM_REAL_IP_HEADER`: Set this to the header name sent by your upstream proxy server to indicate the real IP of connecting clients. Default: X-Forwarded-For
|
- `UPSTREAM_REAL_IP_HEADER`: Set this to the header name sent by your upstream proxy server to indicate the real IP of connecting clients. Default: X-Forwarded-For
|
||||||
|
- `FRAPPE_SITE_NAME_HEADER`: NGINX `X-Frappe-Site-Name` header in the HTTP request which matches a site name. Default: `$host`
|
||||||
|
- `HTTP_HOST`: NGINX `Host` header in the HTTP request which matches a site name. Default: `$http_host`
|
||||||
|
|
||||||
### frappe-socketio
|
### frappe-socketio
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user