Created
March 26, 2011 18:56
-
-
Save max-mapper/888539 to your computer and use it in GitHub Desktop.
couchdb cors _show function, put in the shows folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(head, req){ | |
return { | |
"headers": { | |
"Access-Control-Allow-Origin": "*" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"from": "", | |
"to": "_show/cors", | |
"method": "OPTIONS" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My new idea is you put /db/_security
And couch will support an OPTIONS query for any resource in that database, returning the headers it needs based on the client Origin
your validate_doc_update() can also decide about cross-origin updates, based on
req.headers.Origin
vs.sec.cors.origins