From f96444d6f4087cb07cfc7754d2db07b976568649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Fri, 9 Jun 2017 13:34:44 +0200 Subject: [PATCH] Move CORS headers from nginx to ipfs --- site-cookbooks/kosmos-ipfs/recipes/default.rb | 11 +++++++++++ .../templates/default/nginx_conf_ipfs.kosmos.org.erb | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/site-cookbooks/kosmos-ipfs/recipes/default.rb b/site-cookbooks/kosmos-ipfs/recipes/default.rb index 9ea808d..a8f095f 100644 --- a/site-cookbooks/kosmos-ipfs/recipes/default.rb +++ b/site-cookbooks/kosmos-ipfs/recipes/default.rb @@ -21,4 +21,15 @@ ipfs_config "Gateway.Writable" do value true end +# Set up CORS headers +ipfs_config "API.HTTPHeaders.Access-Control-Allow-Credentials" do + value '["true"]' +end +ipfs_config "API.HTTPHeaders.Access-Control-Allow-Methods" do + value '["PUT", "GET", "POST"]' +end +ipfs_config "API.HTTPHeaders.Access-Control-Allow-Origin" do + value '["*"]' +end + include_recipe "kosmos-ipfs::letsencrypt" diff --git a/site-cookbooks/kosmos-ipfs/templates/default/nginx_conf_ipfs.kosmos.org.erb b/site-cookbooks/kosmos-ipfs/templates/default/nginx_conf_ipfs.kosmos.org.erb index abba8e5..62fbee9 100644 --- a/site-cookbooks/kosmos-ipfs/templates/default/nginx_conf_ipfs.kosmos.org.erb +++ b/site-cookbooks/kosmos-ipfs/templates/default/nginx_conf_ipfs.kosmos.org.erb @@ -31,10 +31,6 @@ server { # Increase number of buffers. Default is 8 proxy_buffers 1024 8k; proxy_http_version 1.1; - # CORS headers for Kredits - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT'; - add_header 'Access-Control-Allow-Credentials' 'true'; location /api/v0/cat { proxy_pass http://_ipfs/api/v0/cat;