summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-29 08:45:59 +0200
committerPaul Buetow <paul@buetow.org>2026-01-29 08:45:59 +0200
commita03d1bc9690e81edb508010237f848defc090751 (patch)
tree94a8e8cd514e918624693e0417105e3189ba1c6f
parent108f9516048170ce685d616aa5665a3f53b8cec6 (diff)
Add mod_remoteip for real client IP forwarding
Amp-Thread-ID: https://ampcode.com/threads/T-019c086d-c760-779d-b740-0f748094b62a Co-authored-by: Amp <amp@ampcode.com>
-rw-r--r--docker-image/Dockerfile9
-rw-r--r--docker-image/Justfile2
2 files changed, 8 insertions, 3 deletions
diff --git a/docker-image/Dockerfile b/docker-image/Dockerfile
index 736f25e..98d3ead 100644
--- a/docker-image/Dockerfile
+++ b/docker-image/Dockerfile
@@ -5,9 +5,10 @@ RUN apk update && apk add --no-cache \
bind-tools \
&& rm -rf /var/cache/apk/*
-# Enable CGI module
+# Enable CGI and remoteip modules
RUN sed -i 's/#LoadModule cgid_module/LoadModule cgid_module/' /usr/local/apache2/conf/httpd.conf && \
sed -i 's/#LoadModule cgi_module/LoadModule cgi_module/' /usr/local/apache2/conf/httpd.conf && \
+ sed -i 's/#LoadModule remoteip_module/LoadModule remoteip_module/' /usr/local/apache2/conf/httpd.conf && \
echo 'ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"' >> /usr/local/apache2/conf/httpd.conf && \
echo '<Directory "/usr/local/apache2/cgi-bin">' >> /usr/local/apache2/conf/httpd.conf && \
echo ' AllowOverride None' >> /usr/local/apache2/conf/httpd.conf && \
@@ -15,7 +16,11 @@ RUN sed -i 's/#LoadModule cgid_module/LoadModule cgid_module/' /usr/local/apache
echo ' Require all granted' >> /usr/local/apache2/conf/httpd.conf && \
echo '</Directory>' >> /usr/local/apache2/conf/httpd.conf && \
echo 'DirectoryIndex index.pl index.html' >> /usr/local/apache2/conf/httpd.conf && \
- echo 'AddHandler cgi-script .pl' >> /usr/local/apache2/conf/httpd.conf
+ echo 'AddHandler cgi-script .pl' >> /usr/local/apache2/conf/httpd.conf && \
+ echo 'RemoteIPHeader X-Forwarded-For' >> /usr/local/apache2/conf/httpd.conf && \
+ echo 'RemoteIPInternalProxy 10.0.0.0/8' >> /usr/local/apache2/conf/httpd.conf && \
+ echo 'RemoteIPInternalProxy 192.168.0.0/16' >> /usr/local/apache2/conf/httpd.conf && \
+ echo 'RemoteIPInternalProxy 172.16.0.0/12' >> /usr/local/apache2/conf/httpd.conf
# Copy the CGI script
COPY index.pl /usr/local/apache2/cgi-bin/index.pl
diff --git a/docker-image/Justfile b/docker-image/Justfile
index 82fa7ac..683a55b 100644
--- a/docker-image/Justfile
+++ b/docker-image/Justfile
@@ -1,4 +1,4 @@
-VERSION := "1.0.0"
+VERSION := "1.1.0"
REGISTRY := "registry.lan.buetow.org:30001"
IMAGE := "ipv6test"