incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Klo <jim....@sri.com>
Subject Re: rewrites not working
Date Tue, 12 Nov 2013 17:52:02 GMT
Like Bob mentioned…  the user that runs CouchDB needs to be a sudoer in order to bind to
a port less that 1024.


On Nov 12, 2013, at 2:27 AM, Alexander Gabriel <alex@barbalex.ch>
 wrote:

> Hi Jim
> 
> I had some trouble configuring my local.ini file.
> 
> Setting
> 
> [httpd]
> port = 80
> 
> doesn't work because I get a "Connection refused" answer when connecting
> with curl.
> 

see above comment.

> The only way I got it working was:
> 
> [httpd]
> port = 5984
> bind_address = 0.0.0.0
> 
> then redirecting form 5984 to 80: "iptables -t nat -A PREROUTING -p tcp
> --dport 80 -j REDIRECT --to-ports 5984"
> 
> Is this the reason form my trouble with rewrites?
> 

I'm definitely not an iptables guy… I'd have to look at the manpage to figure out exactly
what that incantation maps to… as well see the other rules you have enabled, since they
can effect what you add.  Typicaly to make that kind of change to iptables, you'd need to:


	sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984

Since I'm usually running both CouchDB and an application server or some sort on the same
machine - I typically use NGINX or Apache to do a reverse proxy if I need external access
to couchdb as I can be a bit more fine grained than iptables.


> The vhost I set was: arteigenschaften.ch:5984 =
> /artendb/_design/artendb/_rewrite
> 

since you have used a bind_address of 0.0.0.0…  you should be able to access couchdb just
by opening your browser to "http://arteigenschaften.ch:5984", and your rewrites should just
work, provided you have good "from" and "to" specified, and port 5984 isn't blocked from external
access for some reason.  

If you want it to work on port 80, besides getting you iptables configuration working, you
also need a vhost entry in CouchDB local.ini file:

	arteigenschaften.ch:80=/artendb/_design/artendb/_rewrite

I believe you can have multiple vhosts just using different ports or I think you can omit
the port and it will redirect from any port.  Unless you are trying to access different rewrite
handlers from the same domain using different ports, it's pretty safe to just omit the port
number AFAIK.


Mime
View raw message