Skip to content

Commit

Permalink
fix issue with CIDR notation for SET_REAL_IP_FROM env var
Browse files Browse the repository at this point in the history
the slash was causing an issue with sed
  • Loading branch information
NicolasCARPi committed Jul 9, 2023
1 parent ef67af2 commit d9a968e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Container image version
# Note: the version here is from `ELABIMG_VERSION` present in Dockerfile, not the tagged one

# 4.4.1

* Fix `set_real_ip` nginx module not working with CIDR notation

# 4.4.0

* Configure nginx to serve only to whitelisted paths for php
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ RUN abuild-keygen -n -a && abuild && find /home/builder/packages -type f -name '
FROM alpine:3.16

# this is versioning for the container image
ENV ELABIMG_VERSION=4.4.0
ENV ELABIMG_VERSION=4.4.1

# the target elabftw version is passed with --build-arg
# it is a mandatory ARG
Expand Down
3 changes: 2 additions & 1 deletion src/init/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ nginxConf() {
do
conf_string+="set_real_ip_from ${element};"
done
sed -i -e "s/#%REAL_IP_CONF%/${conf_string}/" /etc/nginx/common.conf
# use pipe for sed separation because CIDR might have a /
sed -i -e "s|#%REAL_IP_CONF%|${conf_string}|" /etc/nginx/common.conf
# enable real_ip_header config
sed -i -e "s/#real_ip_header X-Forwarded-For;/real_ip_header X-Forwarded-For;/" /etc/nginx/common.conf
fi
Expand Down

0 comments on commit d9a968e

Please sign in to comment.