mirror of https://gitlab.crans.org/nounous/nixos
nextcloud: CORS (cette fois c’est la bonne)
parent
eafe7b8e0b
commit
1f96169d8c
|
|
@ -54,28 +54,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Activation CORS pour récuppérer les agendas depuis le wiki
|
# Activation CORS pour récuppérer les agendas depuis le wiki
|
||||||
# On est obligé de répéter les headers communs de sécurité car ils ne sont pas au même niveau
|
# TODO: à mettre que sur /remote.php/dav/public-calendars/ pour éviter des requêtes malveillantes depuis le wiki.
|
||||||
# https://github.com/yandex/gixy/blob/master/docs/en/plugins/addheaderredefinition.md
|
services.nginx.virtualHosts.${config.services.nextcloud.hostName}.extraConfig = ''
|
||||||
services.nginx.virtualHosts.${config.services.nextcloud.hostName}.locations."~* /remote.php/dav/public-calendars/[a-z]+\?export".extraConfig =
|
add_header 'Access-Control-Allow-Origin' 'https://mediawiki.crans.org' always;
|
||||||
let
|
add_header 'Access-Control-Allow-Methods' 'GET' always;
|
||||||
base_headers = ''
|
add_header 'Access-Control-Allow-Credentials' 'false' always;
|
||||||
add_header X-Content-Type-Options nosniff;
|
add_header 'Vary' 'Origin' always;
|
||||||
add_header X-Robots-Tag noindex, nofollow;
|
'';
|
||||||
add_header X-Permitted-Cross-Domain-Policies none;
|
|
||||||
add_header X-Frame-Options sameorigin;
|
|
||||||
add_header Referrer-Policy no-referrer;
|
|
||||||
add_header 'Access-Control-Allow-Origin' 'https://mediawiki.crans.org' always;
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
''
|
|
||||||
${base_headers}
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
${base_headers}
|
|
||||||
add_header 'Access-Control-Max-Age' 86400;
|
|
||||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
||||||
add_header 'Content-Length' 0;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue