Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

add-cors-to-couchdb

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

add-cors-to-couchdb

add CORS to couchdb

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
417
decreased by-16.27%
Maintainers
2
Weekly downloads
 
Created
Source

add cors to couchdb

Summary

CouchDB doesn't come with CORS enabled by default. This is a problem for libraries like PouchDB, which depend on being able to access CouchDB no matter what URL it's being served from.

This script fixes that.

Usage
npm install -g add-cors-to-couchdb
add-cors-to-couchdb

or if it is a remote database:

add-cors-to-couchdb http://me.iriscouch.com -u myusername -p mypassword
Ubuntu - special instructions

On Ubuntu the default Node.js library is called nodejs instead of node due to a naming conflict. To run on Ubuntu, you'll need to do:

sudo apt-get install nodejs-legacy
What it does

This script will simply add some generic CORS configuration to your CouchDB. You could also do it yourself trivially using curl:

HOST=http://adminname:password@localhost:5984 # or whatever you got

curl -X POST $HOST/_config/httpd/enable_cors -d '"true"'
curl -X PUT $HOST/_config/cors/origins -d '"*"'
curl -X PUT $HOST/_config/cors/credentials -d '"true"'
curl -X PUT $HOST/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -X PUT $HOST/_config/cors/headers -d '"accept, authorization, content-type, origin, referer"'

You can always change the configuration later by simply going to http://localhost:5984/_utils/config.html and updating the values. However, these default options are good for getting up and running.

Keywords

FAQs

Package last updated on 24 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc