CORS support for pleroma

This commit is contained in:
Bob Mottram 2018-04-01 10:49:30 +01:00
parent 7f7cb0e9ff
commit c42ed5985c
1 changed files with 14 additions and 2 deletions

View File

@ -1058,7 +1058,13 @@ function install_pleroma {
echo ' limit_conn conn_limit_per_ip 50;';
echo ' limit_req zone=req_limit_per_ip burst=50 nodelay;';
echo '';
echo " add_header 'Access-Control-Allow-Origin' '*';";
echo " add_header 'Access-Control-Allow-Origin' '*' always;";
echo " add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;";
echo " add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;";
echo " if (\$request_method = OPTIONS) {";
echo ' return 204;';
echo ' }';
echo '';
echo ' proxy_http_version 1.1;';
echo " proxy_set_header Upgrade \$http_upgrade;";
echo ' proxy_set_header Connection "upgrade";';
@ -1113,7 +1119,13 @@ function install_pleroma {
echo ' limit_conn conn_limit_per_ip 50;';
echo ' limit_req zone=req_limit_per_ip burst=50 nodelay;';
echo '';
echo " add_header 'Access-Control-Allow-Origin' '*';";
echo " add_header 'Access-Control-Allow-Origin' '*' always;";
echo " add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;";
echo " add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;";
echo " if (\$request_method = OPTIONS) {";
echo ' return 204;';
echo ' }';
echo '';
echo ' proxy_http_version 1.1;';
echo " proxy_set_header Upgrade \$http_upgrade;";
echo ' proxy_set_header Connection "upgrade";';