PolymerElements / app-pouchdb

Custom Elements for working with PouchDB.
49 stars 27 forks source link

CORS error using app-pouchdb-query on remote CouchDB #24

Closed garcianavalon closed 8 years ago

garcianavalon commented 8 years ago

Description

After setting up a remote CouchDB and activating CORS I still get a "Referer header must match host." error when using app-pouchdb-query

<app-pouchdb-query
        db-name="http://localhost:5984/kittens"
        selector="_id $gt null"
        data="{{data}}">
  </app-pouchdb-query>

Expected outcome

The documents in the database are loaded in data

Actual outcome

POST http://localhost:5984/kittens/_find 400 (Bad Request)
Object {error: "bad_request", reason: "Referer header must match host.", status: 400, name: "bad_request", message: "Referer header must match host."}

Live Demo

Steps to reproduce

  1. Install and configure a remote CouchDB running in localhost:5984
  2. Put a app-pouchdb-query element as defined above in the page.
  3. Open the page in a web browser.
  4. See the console

    Browsers Affected

bfredo123 commented 8 years ago

Hi,

did you get a way to fix this?

It seems to relate to: https://github.com/pouchdb/pouchdb/issues/5810 https://github.com/pouchdb/pouchdb/issues/5501

Thanks

garcianavalon commented 8 years ago

Yes! I changed the CouchDB version from 1.X to 2.Y and worked perfectly :) I'm using this unofficial docker image because the official one is not yet at 2 and failed.

Sad news is I couldn't locate the cause of the error for those that can't upgrade :(