Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional environment variables to better support reverse proxies #335

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ ENV \
NGINX_PROXY_READ_TIMEOUT=60s \
NGINX_PROXY_SEND_TIMEOUT=60s \
NGINX_REAL_IP_HEADER=X-Forwarded-For \
NGINX_REAL_IP_RECURSIVE=off \
NGINX_SEND_TIMEOUT=60s \
NGINX_SET_REAL_IP_FROM=172.0.0.0/8 \
NGINX_SET_REAL_IP_FROM2=172.0.0.0/8 \
NGINX_SET_REAL_IP_FROM3=172.0.0.0/8 \
NGINX_WORKER_CONNECTIONS=1024 \
NGINX_WORKER_PROCESSES=auto \
PHP_DEFAULT_SOCKET_TIMEOUT=60 \
Expand Down
3 changes: 3 additions & 0 deletions nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ Requires `islandora/base` docker image to build. Please refer to the
| NGINX_PROXY_READ_TIMEOUT | 60s | Timeout for reading a response from the proxied server |
| NGINX_PROXY_SEND_TIMEOUT | 60s | Timeout for transmitting a request to the proxied server |
| NGINX_REAL_IP_HEADER | X-Forwarded-For | Request header field whose value will be used to replace the client address. |
| NGINX_REAL_IP_RECURSIVE | off | See https://nginx.org/en/docs/http/ngx_http_realip_module.html |
| NGINX_SEND_TIMEOUT | 60s | Timeout for transmitting a response to the client |
| NGINX_SET_REAL_IP_FROM | 172.0.0.0/8 | Trusted addresses that are known to send correct replacement addresses |
| NGINX_SET_REAL_IP_FROM2 | 172.0.0.0/8 | Trusted addresses that are known to send correct replacement addresses |
| NGINX_SET_REAL_IP_FROM3 | 172.0.0.0/8 | Trusted addresses that are known to send correct replacement addresses |
| NGINX_WORKER_CONNECTIONS | 1024 | The maximum number of simultaneous connections that can be opened by a worker process |
| NGINX_WORKER_PROCESSES | auto | Set number of worker processes automatically based on number of CPU cores |

Expand Down
3 changes: 3 additions & 0 deletions nginx/rootfs/etc/confd/templates/nginx.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ http {

# Sets the client IP to print in logs
real_ip_header {{ getenv "NGINX_REAL_IP_HEADER" }};
real_ip_recursive {{ getenv "NGINX_REAL_IP_RECURSIVE" }};
set_real_ip_from {{ getenv "NGINX_SET_REAL_IP_FROM" }};
set_real_ip_from {{ getenv "NGINX_SET_REAL_IP_FROM2" }};
set_real_ip_from {{ getenv "NGINX_SET_REAL_IP_FROM3" }};

# Includes virtual hosts configs.
include /etc/nginx/http.d/*.conf;
Expand Down
Loading