On 09/21/2012 10:07 AM, Ryan Ramage wrote:
John,
It seems you are serving your html from port 80, but it is trying to
access couchdb on port 5984. That is a cross domain request.
using couch.jquery.js I think what you can do is fiddle with
$.couch.urlPrefix = "/_couch";
I know there's a problem with the cross domain, however, having real
trouble getting around it. Currently the nginx config I listed is not
working.
I'm puzzled by the "/_couch" prefix (what does the underscore do ?) how
does that change the cross domain problem ?
R
On Fri, Sep 21, 2012 at 9:50 AM, john.tiger<[email protected]> wrote:
On 09/21/2012 09:09 AM, Simon Metson wrote:
Do you get anything in either CouchDB or nginx logs?
from javascript console:
XMLHttpRequest cannot load http://127.0.0.1:5984/testdb/_view/getuserdoc.
Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin
from /var/log/couchdb:
[Fri, 21 Sep 2012 15:37:39 GMT] [info] [<0.3712.0>] 127.0.0.1 - - GET
/testdb/_view/getuserdoc 404
from
2012/09/21 09:37:18 [emerg] 5001#0: "proxy_pass" cannot have URI part in
location given by regular expression, or inside named location, or inside
"if" statement, or inside "limit_except" block in
/etc/nginx/sites-enabled/dev-testdb:13
2012/09/21 09:37:19 [emerg] 5002#0: "proxy_pass" cannot have URI part in
location given by regular expression, or inside named location, or inside
"if" statement, or inside "limit_except" block in
/etc/nginx/sites-enabled/dev-testdb:13
On Friday, 21 September 2012 at 16:07, john.tiger wrote:
On 09/21/2012 06:00 AM, Simon Metson wrote:
Yup, you'll need to proxy CouchDB so that everything appears to come
from the same server.
http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent
place to start.
thks for this reference - still cannot get it to work - here is the file
(in sites-available symlinked to sites-enabled (nginx.conf is still the
default except with user added to top)
any help appreciated
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /home/work/couchdb/testdb;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location ^/(.*)/_changes {
proxy_pass http://127.0.0.1:5984/;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /testdb {
rewrite /testdb/(.*) /$1 break;
proxy_pass http://127.0.0.1:5984/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
On Thursday, 20 September 2012 at 22:04, john.tiger wrote:
On 09/20/2012 01:26 PM, Simon Metson wrote:
Hey John,
http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might
be a useful reference for you.
I've got a working example that I'll put online tomorrow. It uses
backbone Events to communicate when someone logs in/out, but if you don't
need/want that removing it should be easy enough.
Cheers
Simon
hmm, I'm suspecting our stuff was "silently" failing - using straight
$.getjson call now shows:
Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
the nginx conf is set up to render html pages at http://127.0.0.1
wondering if the nginx conf needs a line:
location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
On 09/18/2012 04:32 PM, Simon Metson wrote:
You're trying to do login/session/logout in Backbone? Give me a few
days
and I can write up an example app.
no not in Backbone, just in our own html5 and jquery code. Going thru
the jquery.couch lib and futon lib, I started to document the needed
calls - still not quite there - for example, to create a user (reader
type) do you still have to create the password hash first or does
couch
now do that ....