Skip to content

Commit

Permalink
Merge pull request #2778 from ipfs/feature/CORS-on-gateway-by-default
Browse files Browse the repository at this point in the history
Add CORS headers to Read Only Gateway Default config
  • Loading branch information
whyrusleeping committed Jun 15, 2016
2 parents 323441d + c039338 commit 16245db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions repo/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
RootRedirect: "",
Writable: false,
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"},
},
},
}

Expand Down
4 changes: 0 additions & 4 deletions test/sharness/t0112-gateway-cors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
test_description="Test HTTP Gateway CORS Support"

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-Methods '["PUT", "GET", "POST"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["X-Requested-With"]'
Expand Down

0 comments on commit 16245db

Please sign in to comment.