Compare commits

..

1 Commits

Author SHA1 Message Date
e8a8f636d0 add headers to embed nextcloud in frame on external site
Some checks failed
continuous-integration/drone/pr Build is failing
This introduces new env variables to configure nextloud to be embedded via
iframe on an external site.
Setting X_FRAME_OPTIONS_ENABLED=1 will configure nginx and nextcloud to
set X-Frame-Options and CSP headers to allow the domain configured in
X_FRAME_OPTIONS_ALLOW_FROM.
2022-08-31 15:40:18 +02:00
6 changed files with 10 additions and 11 deletions

View File

@ -1,6 +1,6 @@
TYPE=nextcloud
DOMAIN={{ .Domain }}
DOMAIN=nextcloud.example.com
## Domain aliases
#EXTRA_DOMAINS=', `www.nextcloud.example.com`'
LETS_ENCRYPT_ENV=production

View File

@ -1,7 +1,7 @@
export FPM_TUNE_VERSION=v4
export NGINX_CONF_VERSION=v4
export NGINX_CONF_VERSION=v3
export MY_CNF_VERSION=v4
export ENTRYPOINT_VERSION=v2
export ENTRYPOINT_VERSION=v1
NC_APP_DIR="app:/var/www/html"

View File

@ -2,6 +2,7 @@ version: '3.8'
services:
app:
entrypoint: "sh -c 'sleep 10 && /entrypoint.sh php-fpm'" # tries to mitigate this error with postgres https://github.com/nextcloud/docker/issues/1204
environment:
- POSTGRES_HOST=db
- POSTGRES_DB=nextcloud

View File

@ -35,7 +35,7 @@ services:
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
app:
image: nextcloud:24.0.6-fpm
image: nextcloud:24.0.3-fpm
depends_on:
- db
configs:
@ -77,12 +77,12 @@ services:
failure_action: rollback
order: start-first
labels:
- "coop-cloud.${STACK_NAME}.version=2.1.4+24.0.6-fpm"
- "coop-cloud.${STACK_NAME}.version=2.1.2+24.0.3-fpm"
- "backupbot.backup=true"
- "backupbot.backup.path=/var/www/html/config/,/var/www/html/data/,/var/www/html/custom_apps/"
cron:
image: nextcloud:24.0.6-fpm
image: nextcloud:24.0.3-fpm
volumes:
- nextcloud:/var/www/html/
- nextapps:/var/www/html/custom_apps:cached
@ -94,7 +94,7 @@ services:
entrypoint: /cron.sh
cache:
image: redis:7.0.5-alpine
image: redis:7.0.4-alpine
networks:
- internal
volumes:

View File

@ -1,8 +1,5 @@
#!/bin/bash
echo "Giving the db container some time to come up"; sleep 20
# see this issue with postgres db https://github.com/nextcloud/docker/issues/1204
{{ if eq (env "X_FRAME_OPTIONS_ENABLED") "1" }}
if ! [[ $(grep {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} lib/public/AppFramework/Http/ContentSecurityPolicy.php) ]]; then
sed -i "91 a\\\t\t'{{ env "X_FRAME_OPTIONS_ALLOW_FROM" }}', " lib/public/AppFramework/Http/ContentSecurityPolicy.php

View File

@ -67,7 +67,8 @@ http {
add_header X-XSS-Protection "1; mode=block" always;
{{ if eq (env "X_FRAME_OPTIONS_ENABLED") "1" }}
add_header Content-Security-Policy "frame-ancestors {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} {{ env "DOMAIN" }}";
add_header X-Frame-Options "{{ env "X_FRAME_OPTIONS_ALLOW_FROM" }}" always;
add_header Content-Security-Policy "frame-ancestors {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }}";
{{ else }}
add_header X-Frame-Options "SAMEORIGIN" always;
{{ end }}