From f7de7e215a19701123721ffcf6e88b1b389a7832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Mon, 20 Mar 2017 22:49:06 +0000 Subject: [PATCH] Move the CORS headers from IPFS to the nginx reverse proxy --- site-cookbooks/kosmos-ipfs/recipes/default.rb | 5 ----- .../templates/default/nginx_conf_ipfs.kosmos.org.erb | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/site-cookbooks/kosmos-ipfs/recipes/default.rb b/site-cookbooks/kosmos-ipfs/recipes/default.rb index aac5270..9ea808d 100644 --- a/site-cookbooks/kosmos-ipfs/recipes/default.rb +++ b/site-cookbooks/kosmos-ipfs/recipes/default.rb @@ -16,11 +16,6 @@ ipfs_config "Addresses.Gateway" do value "/ip4/127.0.0.1/tcp/9090" end -# Set up CORS headers -ipfs_config "API.HTTPHeaders.Access-Control-Allow-Origin" do - value ["kredits.kosmos.org"] -end - # Set up the Gateway to be writable ipfs_config "Gateway.Writable" do value true 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 c0f660b..7aaff58 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,6 +31,8 @@ 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' 'https://kredits.kosmos.org'; location /api/v0/cat { proxy_pass http://_ipfs/api/v0/cat;