[wip] Enable CORS on API

This commit is contained in:
ljf 2022-08-06 22:52:04 +02:00
parent 92a751ed84
commit ec5ce84afd

View file

@ -6,6 +6,15 @@ location /yunohost/api/ {
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host; 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" %} {% if webadmin_allowlist_enabled == "True" %}
{% for ip in webadmin_allowlist.split(',') %} {% for ip in webadmin_allowlist.split(',') %}
allow {{ ip }}; allow {{ ip }};