Skip to content

Commit 90021a0

Browse files
authored
Merge pull request #22 from dokuwiki/remoteip
enable mod_remoteip. fixes #21
2 parents b6e07d2 + b59c6af commit 90021a0

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ ARG DOKUWIKI_VERSION=stable
1111
ENV PHP_UPLOADLIMIT 128M
1212
ENV PHP_MEMORYLIMIT 256M
1313
ENV PHP_TIMEZONE UTC
14+
ENV FORWARDING_PROXY 172.16.0.0/12
15+
ENV FORWARDING_HEADER X-Forwarded-For
1416

1517
COPY root /
1618
RUN /bin/bash /build-setup.sh

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ On first run, use DokuWiki's [installer](https://www.dokuwiki.org/installer) to
2626
## Features
2727

2828
* xsendfile configured and enabled
29+
* mod_remoteip enabled and configured to trust the standard Docker networking range
2930
* imagemagick installed and enabled
3031
* nice URLs via rewriting configured and enabled
3132
* farming support via the [farmer plugin](https://www.dokuwiki.org/plugin:farmer)
@@ -44,6 +45,11 @@ The container runs the standard production php.ini. Some options can be set via
4445

4546
Custom PHP configuration values can be set in a `php.ini` file in the storage volume.
4647

48+
The remoteip module is enabled and configured to use the `X-Forwarded-For` header and trust the standard Docker networking range. You can override both using the following environment variables:
49+
50+
* `FORWARDING_PROXY` - The trusted proxy IP range. Default `172.16.0.0/12`
51+
* `FORWARDING_HEADER` - The header to trust for the client IP. Default `X-Forwarded-For`
52+
4753
## Permissions
4854

4955
When the container is started without setting an explicit user id (as the compose file suggests), the image will start as

root/build-setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ a2enconf dokuwiki
1515
a2disconf security
1616
a2enmod rewrite
1717
a2enmod xsendfile
18+
a2enmod remoteip
1819

1920
# Download DokuWiki from the official website or from GitHub
2021
curl --fail -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-${DOKUWIKI_VERSION}.tgz" -o dokuwiki.tgz || \

root/etc/apache2/conf-available/dokuwiki.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ ServerTokens Prod
1515
ServerSignature Off
1616
RedirectMatch 404 /\.git
1717
TraceEnable Off
18+
19+
RemoteIPInternalProxy ${FORWARDING_PROXY}
20+
RemoteIPHeader ${FORWARDING_HEADER}

0 commit comments

Comments
 (0)