Nolan Lawson created COUCHDB-2245:
-------------------------------------
Summary: Couch returns 404 for OPTIONS in Chrome web worker
Key: COUCHDB-2245
URL: https://issues.apache.org/jira/browse/COUCHDB-2245
Project: CouchDB
Issue Type: Bug
Security Level: public (Regular issues)
Reporter: Nolan Lawson
See [the PouchDB issue|https://github.com/pouchdb/pouchdb/pull/2252] for full
details, or here's a TLDR:
1. Run {{telnet localhost 5984}}
2. Paste in the following:
{code}
OPTIONS /my_database_name HTTP/1.1
Host: localhost:5984
Connection: keep-alive
Access-Control-Request-Method: GET
Origin: http://localhost:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Access-Control-Request-Headers: accept, content-type
Accept: */*
Referer:
http://localhost:8000/tests/test.html?grep=browser.worker.js%20create%20remote%20db
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
{code}
You'll correctly get back:
{code}
HTTP/1.1 204 No Content
Server: CouchDB/1.5.0 (Erlang OTP/R16B03)
Date: Mon, 19 May 2014 20:25:48 GMT
Content-Length: 0
Access-Control-Max-Age: 12345
Access-Control-Allow-Origin: http://localhost:8000
Access-Control-Allow-Methods: GET, PUT, POST, HEAD, DELETE
Access-Control-Allow-Headers: accept, content-type
Access-Control-Allow-Credentials: true
{code}
Now paste in:
{code}
OPTIONS /my_database_name HTTP/1.1
Host: localhost:5984
Connection: keep-alive
Access-Control-Request-Method: GET
Origin: http://localhost:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Access-Control-Request-Headers: accept, referer, content-type
Accept: */*
Referer:
http://localhost:8000/tests/test.html?grep=browser.worker.js%20create%20remote%20db
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
{code}
And you'll get:
{code}
HTTP/1.1 404 Object Not Found
Server: CouchDB/1.5.0 (Erlang OTP/R16B03)
Date: Mon, 19 May 2014 20:26:42 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 44
Cache-Control: must-revalidate
Access-Control-Expose-Headers: Content-Type, Server
Access-Control-Allow-Origin: http://localhost:8000
Access-Control-Allow-Credentials: true
{"error":"not_found","reason":"no_db_file"}
{code}
This is unfortunate, because Chrome web workers seem to be sending the second
value for {{Access-Control-Request-Headers}} by default.
--
This message was sent by Atlassian JIRA
(v6.2#6252)