Hi,

when developing Angular apps I usually serve the application by NGINX 
server and use a virtual host to serve the application.
When I need to access the backend API or any other services like CouchDB I 
define a proxy so I don't need to do any CORS requests as it's served by 
the same host.

This is a sample setup in nginx.conf:

server {
listen 80;
server_name foo.dev;
server_name foo.local;

# Static resources
location / {
root /Users/Juan/Projects/foo/app;
autoindex on;
try_files $uri $uri/index.html $uri/ =404;
}

# Backend services
location /api {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

# CouchDB
location /db {
proxy_pass http://127.0.0.1:5984/foo;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

My application can request CouchDB using via /db path.
I guess you can do something similar for your Couchbase Lite listening on 
port 5984.

Hope it helps
Juan

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/7a855794-0e9a-4991-9084-579b2c92f3e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to