Skip to content

Instantly share code, notes, and snippets.

@ryanramage
Created March 12, 2013 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanramage/5143964 to your computer and use it in GitHub Desktop.
Save ryanramage/5143964 to your computer and use it in GitHub Desktop.
CORS alternating not working/working on the view /dashboard/_design/dashboard/_view/dashboard_assets.
[debug] [<0.148.0>] 'GET' /_session {1,1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-US,en;q=0.8"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Host',"localhost:5984"},
{"Origin","http://localhost:8000"},
{'Referer',"http://localhost:8000/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22"}]
[debug] [<0.148.0>] OAuth Params: []
[info] [<0.148.0>] 127.0.0.1 - - GET /_session 200
[debug] [<0.149.0>] 'GET' /_session {1,1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Encoding',"gzip, deflate"},
{'Accept-Language',"en-US,en;q=0.5"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Cookie',"badges=1; __utma=111872281.645323704.1339301481.1346779136.1350575467.4; __utmz=111872281.1339301481.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); AuthSession=YWRtaW46NTEzQUIwODM6Oibfggc0zBlvCvi81IMY9NjAMRg"},
{'Host',"localhost:5984"},
{'Referer',"http://localhost:5984/answers_1/_design/answers/_rewrite/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:19.0) Gecko/20100101 Firefox/19.0"}]
[debug] [<0.149.0>] OAuth Params: []
[debug] [<0.149.0>] timeout 9999999
[info] [<0.149.0>] 127.0.0.1 - - GET /_session 200
[debug] [<0.148.0>] 'GET' /_session {1,1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-US,en;q=0.8"},
{'Cache-Control',"max-age=0"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Host',"localhost:5984"},
{"Origin","http://localhost:8000"},
{'Referer',"http://localhost:8000/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22"}]
[debug] [<0.148.0>] OAuth Params: []
[info] [<0.148.0>] 127.0.0.1 - - GET /_session 200
[debug] [<0.148.0>] 'OPTIONS' /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true {1,
1} from "127.0.0.1"
Headers: [{'Accept',"*/*"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-US,en;q=0.8"},
{"Access-Control-Request-Headers","accept, origin, content-type"},
{"Access-Control-Request-Method","GET"},
{'Connection',"keep-alive"},
{'Host',"localhost:5984"},
{"Origin","http://localhost:8000"},
{'Referer',"http://localhost:8000/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22"}]
[info] [<0.148.0>] 127.0.0.1 - - OPTIONS /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true 204
[debug] [<0.148.0>] 'GET' /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true {1,
1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-US,en;q=0.8"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Host',"localhost:5984"},
{'If-None-Match',"\"V9J3604P4V9VTR5H77SBHJW\""},
{"Origin","http://localhost:8000"},
{'Referer',"http://localhost:8000/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22"}]
[debug] [<0.148.0>] OAuth Params: [{"reduce","false"},{"include_docs","true"}]
[info] [<0.148.0>] 127.0.0.1 - - GET /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true 304
[error] [<0.148.0>] function_clause error in HTTP request
[info] [<0.148.0>] Stacktrace: [{string,to_lower,
[undefined],
[{file,"string.erl"},{line,468}]},
{couch_httpd_cors,maybe_apply_cors_headers,2,
[{file,
"/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/couchdb/couch_httpd_cors.erl"},
{line,219}]},
{couch_httpd,send_response,4,
[{file,
"/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/couchdb/couch_httpd.erl"},
{line,706}]},
{couch_mrview_http,design_doc_view,5,
[{file,
"/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/couch_mrview/src/couch_mrview_http.erl"},
{line,147}]},
{couch_httpd_db,do_db_req,2,
[{file,
"/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/couchdb/couch_httpd_db.erl"},
{line,234}]},
{couch_httpd,handle_request_int,5,
[{file,
"/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/couchdb/couch_httpd.erl"},
{line,331}]},
{mochiweb_http,headers,5,
[{file,
"/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/mochiweb/mochiweb_http.erl"},
{line,136}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,227}]}]
[info] [<0.148.0>] 127.0.0.1 - - GET /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true 500
[error] [<0.148.0>] httpd 500 error response:
{"error":"unknown_error","reason":"function_clause"}
[debug] [<0.149.0>] 'GET' /_session {1,1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Encoding',"gzip, deflate"},
{'Accept-Language',"en-US,en;q=0.5"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Cookie',"badges=1; __utma=111872281.645323704.1339301481.1346779136.1350575467.4; __utmz=111872281.1339301481.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); AuthSession=YWRtaW46NTEzQUIwODM6Oibfggc0zBlvCvi81IMY9NjAMRg"},
{'Host',"localhost:5984"},
{'Referer',"http://localhost:5984/answers_1/_design/answers/_rewrite/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:19.0) Gecko/20100101 Firefox/19.0"}]
[debug] [<0.149.0>] OAuth Params: []
[debug] [<0.149.0>] timeout 9999999
[info] [<0.149.0>] 127.0.0.1 - - GET /_session 200
[debug] [<0.148.0>] 'GET' /_session {1,1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-US,en;q=0.8"},
{'Cache-Control',"max-age=0"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Host',"localhost:5984"},
{"Origin","http://localhost:8000"},
{'Referer',"http://localhost:8000/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22"}]
[debug] [<0.148.0>] OAuth Params: []
[info] [<0.148.0>] 127.0.0.1 - - GET /_session 200
[debug] [<0.148.0>] 'GET' /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true {1,
1} from "127.0.0.1"
Headers: [{'Accept',"application/json"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-US,en;q=0.8"},
{'Connection',"keep-alive"},
{'Content-Type',"application/json"},
{'Host',"localhost:5984"},
{"Origin","http://localhost:8000"},
{'Referer',"http://localhost:8000/"},
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22"}]
[debug] [<0.148.0>] OAuth Params: [{"reduce","false"},{"include_docs","true"}]
[info] [<0.148.0>] 127.0.0.1 - - GET /dashboard/_design/dashboard/_view/dashboard_assets?reduce=false&include_docs=true 200
@ryanramage
Copy link
Author

Ok, I have reproduced it in curl. It seems to be the header "If-None-Match" that causes the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment