From ec5ce84afd0bb42b636736b7330e069f17911556 Mon Sep 17 00:00:00 2001 From: ljf Date: Sat, 6 Aug 2022 22:52:04 +0200 Subject: [PATCH] [wip] Enable CORS on API --- conf/nginx/yunohost_api.conf.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conf/nginx/yunohost_api.conf.inc b/conf/nginx/yunohost_api.conf.inc index c9ae34f82..d2b6c7d24 100644 --- a/conf/nginx/yunohost_api.conf.inc +++ b/conf/nginx/yunohost_api.conf.inc @@ -6,6 +6,15 @@ location /yunohost/api/ { proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; + # Rewrite CORS headers due to bug inside moulinette + # cause it's very difficult to add them with bottle + # framework 0.12. + # https://github.com/YunoHost/moulinette/pull/324 + more_set_headers "Access-Control-Allow-Origin : *"; + more_set_headers "Access-Control-Allow-Headers: x-requested-with"; + more_set_headers "Allow: GET, POST, PUT, DELETE, OPTIONS"; + more_set_headers "Access-Control-Allow-Credentials: true"; + {% if webadmin_allowlist_enabled == "True" %} {% for ip in webadmin_allowlist.split(',') %} allow {{ ip }};