mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 09:59:13 +08:00
Merge pull request #2778 from ipfs/feature/CORS-on-gateway-by-default
Add CORS headers to Read Only Gateway Default config
This commit is contained in:
@ -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 @@
|
|||||||
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"]'
|
||||||
|
Reference in New Issue
Block a user