Tag Archives: NoSQL

22Jul/14

CouchDB: How to enable CORS in CouchDB

I was playing around with consumption of a CouchDB JSON feed when I received the familiar “Cross-Origin Request Blocked” error.  The question is, “How do you enable CORS in CouchDB?”

If you open the ‘Configuration’ tool, you will find ‘enable_cors’ under ‘httpd’.  You want to change that value to ‘true’.

Enable CORS - CouchDB - Part 1

 

Next, if you scroll down to the bottom of the page, you will find an ‘Add a new section’ link.  You want to click on that and add an ‘origins’ option with the value of ‘*’ in the ‘cors’ section.  You can set the ‘origins’ value to an actual URL but this will enable CORS for everybody.

Enable CORS - CouchDB - 2

 

I would like to give a ‘tip of the hat’ to RichITExperience for having this answer.  It looks like nobody else had any good info about this.

 

14Jul/14

CouchDB: Requiring users of your database be valid users

So, you just created a CouchDB database, added a user to it, and want access to be limited to that user?  There is a simple way of doing this.  Let’s use a previous example, for this demo.

As you can see below, by default, you do not need to be authenticated, in order to interact with a database.

Secure Couch DB 1

 

You can use the “Configuration” tool, on the right sidebar, to do that.  If you look under “couch_httpd_auth”, there is a boolean called “require_valid_user”.  By default, the value is “false”.  You can change that to “true”.

Secure Couch DB 2

 

Once the value is set to “true”, it will require you to do an http authentication for your requests.

Secure Couch DB 3

 

This is definitely an unrefined, blunt way of securing your databases.  It works, though.

11Jul/14

CouchDB: Creation, population, and querying of a DB

If you are like me, you probably have not had much of a reason to use NoSQL but you have been interested in it.  I recently decided to check out CouchDB.  CouchDB is an Apache project that was created in 2005 by Damien Katz.  CouchDB is interesting in that it stores your data with JSON documents and allows you to query via HTTP.  This means that CouchDB provides it’s own web service.

Continue reading