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

Allow Referrer-Policy header to be configured #450

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions 12.0/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ RUN { \

VOLUME /var/www/html

RUN a2enmod rewrite remoteip ;\
RUN a2enmod rewrite remoteip env headers ;\
{\
echo RemoteIPHeader X-Real-IP ;\
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
} > /etc/apache2/conf-available/remoteip.conf;\
a2enconf remoteip
{\
echo PassEnv APACHE_REFERRER_POLICY ;\
echo Header set Referrer-Policy "%{APACHE_REFERRER_POLICY}e" "env=APACHE_REFERRER_POLICY" ;\
} > /etc/apache2/conf-available/referrerpolicy.conf;\
a2enconf remoteip referrerpolicy

ENV NEXTCLOUD_VERSION 12.0.11

Expand Down
8 changes: 6 additions & 2 deletions 13.0/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ RUN { \

VOLUME /var/www/html

RUN a2enmod rewrite remoteip ;\
RUN a2enmod rewrite remoteip env headers ;\
{\
echo RemoteIPHeader X-Real-IP ;\
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
} > /etc/apache2/conf-available/remoteip.conf;\
a2enconf remoteip
{\
echo PassEnv APACHE_REFERRER_POLICY ;\
echo Header set Referrer-Policy "%{APACHE_REFERRER_POLICY}e" "env=APACHE_REFERRER_POLICY" ;\
} > /etc/apache2/conf-available/referrerpolicy.conf;\
a2enconf remoteip referrerpolicy

ENV NEXTCLOUD_VERSION 13.0.6

Expand Down
8 changes: 6 additions & 2 deletions 14.0/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ RUN { \

VOLUME /var/www/html

RUN a2enmod rewrite remoteip ;\
RUN a2enmod rewrite remoteip env headers ;\
{\
echo RemoteIPHeader X-Real-IP ;\
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
} > /etc/apache2/conf-available/remoteip.conf;\
a2enconf remoteip
{\
echo PassEnv APACHE_REFERRER_POLICY ;\
echo Header set Referrer-Policy "%{APACHE_REFERRER_POLICY}e" "env=APACHE_REFERRER_POLICY" ;\
} > /etc/apache2/conf-available/referrerpolicy.conf;\
a2enconf remoteip referrerpolicy

ENV NEXTCLOUD_VERSION 14.0.0

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ If you want you can set the data directory and table prefix, otherwise default v
- `NEXTCLOUD_DATA_DIR` (default: _/var/www/html/data_) Configures the data directory where nextcloud stores all files from the users.
- `NEXTCLOUD_TABLE_PREFIX` (default: _""_) Optional prefix for the tables. Used to be `oc_` in the past

If you want you can set the `Referrer-Policy` header, otherwise the header won't be added to the response.

- `APACHE_REFERRER_POLICY` Sets the value of the `Referrer-Policy` header (`apache` variant only).


# Running this image with docker-compose
The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for.
Expand Down
2 changes: 1 addition & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ declare -A base=(
)

declare -A extras=(
[apache]='\nRUN a2enmod rewrite remoteip ;\\\n {\\\n echo RemoteIPHeader X-Real-IP ;\\\n echo RemoteIPTrustedProxy 10.0.0.0/8 ;\\\n echo RemoteIPTrustedProxy 172.16.0.0/12 ;\\\n echo RemoteIPTrustedProxy 192.168.0.0/16 ;\\\n } > /etc/apache2/conf-available/remoteip.conf;\\\n a2enconf remoteip'
[apache]='\nRUN a2enmod rewrite remoteip env headers ;\\\n {\\\n echo RemoteIPHeader X-Real-IP ;\\\n echo RemoteIPTrustedProxy 10.0.0.0/8 ;\\\n echo RemoteIPTrustedProxy 172.16.0.0/12 ;\\\n echo RemoteIPTrustedProxy 192.168.0.0/16 ;\\\n } > /etc/apache2/conf-available/remoteip.conf;\\\n {\\\n echo PassEnv APACHE_REFERRER_POLICY ;\\\n echo Header set Referrer-Policy "%{APACHE_REFERRER_POLICY}e" "env=APACHE_REFERRER_POLICY" ;\\\n } > /etc/apache2/conf-available/referrerpolicy.conf;\\\n a2enconf remoteip referrerpolicy'
[fpm]=''
[fpm-alpine]=''
)
Expand Down