Commit 16245dbd authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub

Merge pull request #2778 from ipfs/feature/CORS-on-gateway-by-default

Add CORS headers to Read Only Gateway Default config
parents 323441d7 c0393383
...@@ -62,6 +62,11 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) { ...@@ -62,6 +62,11 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
RootRedirect: "", RootRedirect: "",
Writable: false, Writable: false,
PathPrefixes: []string{}, PathPrefixes: []string{},
HTTPHeaders: map[string][]string{
"Access-Control-Allow-Origin": []string{"*"},
"Access-Control-Allow-Methods": []string{"GET"},
"Access-Control-Allow-Headers": []string{"X-Requested-With"},
},
}, },
} }
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
test_description="Test HTTP Gateway CORS Support" test_description="Test HTTP Gateway CORS Support"
test_config_ipfs_cors_headers() { test_config_ipfs_cors_headers() {
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Headers '["X-Requested-With"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["X-Requested-With"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["X-Requested-With"]'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment