Search code examples
httpscouchdbcouchdb-2.0

CouchDB can't set up HTTPS


I am learning to work with CouchDB and I am usually making Ajax calls in order to communicate with my database. I started getting '

Cross-Origin Request blocked

' and as the reason

Access-Control-Allow-Origin

, so I decided to work with CouchDB through HTTPS and not the standard HTTP. For that, I have followed the instructions given on Link to manual.

Problem on Linux:
I first tried to set it up on my laptop where I use Linux. But I couldn't find the Local.ini file where I was supposed to set the paths to the certificates.

After unsuccessfully trying to find a solution for it, I gave up and started from the beginning on my computer, where I use Windows.

Problem on Windows:
So I installed the newest version of CouchDB on my Windows, I have created the certificates, found the Local.ini file, did everything as it is explained in the manual. The problem was that I couldn't restart CouchDB so that the changes would take place. So, after google-ing the problem, I found a possible solution, to stop CouchDB through the Task Manager->Services-> Stop Apache CouchDB. But when I tried to Start it again I get the problem

Windows could not start the Apache CouchDB on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specification error code 3.

I would be very happy if someone could help me with my problem(s). I prefer getting a solution for the Linux problem since I work mostly on my laptop, but I will be satisfied if I get it going even on Windows.

Thanks in advance


Solution

  • On Linux, you can add CORS to CouchDB with this package:

    https://github.com/pouchdb/add-cors-to-couchdb