Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Latest commit

 

History

History
23 lines (14 loc) · 830 Bytes

CORS.md

File metadata and controls

23 lines (14 loc) · 830 Bytes

CORS

Table of Contents

Overview

Cross-origin Resource Sharing is a browser security mechanism that prevents unauthorized scripts from accessing resources from different domains.

By default the HTTP RPC API of js-IPFS will cause any request sent from a CORS-respecting browser to fail.

Configure CORS headers

You can configure your node to allow requests from other domains to proceed by setting the appropriate headers in the node config:

$ jsipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin  '["http://example.com"]'
$ jsipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'

Restart the daemon for the settings to take effect.