diff --git a/hosts/vm/nextcloud/nextcloud.nix b/hosts/vm/nextcloud/nextcloud.nix index c77cf3b..ae17b0a 100644 --- a/hosts/vm/nextcloud/nextcloud.nix +++ b/hosts/vm/nextcloud/nextcloud.nix @@ -52,4 +52,17 @@ appstoreEnable = true; extraAppsEnable = true; }; + + # Activation CORS pour récuppérer les agendas depuis le wiki + 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; + add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Max-Age' 86400; + add_header 'Content-Type' 'text/plain; charset=utf-8'; + add_header 'Content-Length' 0; + return 204; + } + ''; }