Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/docs/src/best-practices/reverse-proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ Reverse proxying CouchDB in a subdirectory with Caddy 2
It can be useful to provide CouchDB as a subdirectory of your overall domain,
especially to avoid CORS concerns. Here's an excerpt of a basic Caddy
configuration that proxies the URL ``http(s)://domain.com/couchdb`` to
``http://localhost:5984`` so that requests appended to the subdirectory, such
``http://localhost:5984/couchdb`` so that requests appended to the subdirectory, such
as ``http(s)://domain.com/couchdb/db1/doc1`` are proxied to
``http://localhost:5984/db1/doc1``.
``http://localhost:5984/couchdb/db1/doc1``.

.. code-block:: text

Expand All @@ -221,6 +221,24 @@ as ``http(s)://domain.com/couchdb/db1/doc1`` are proxied to

}

To proxy the URL ``http(s)://domain.com/couchdb`` to
``http://localhost:5984`` so that requests appended to the subdirectory, such
as ``http(s)://domain.com/couchdb/db1/doc1`` are proxied to
``http://localhost:5984/db1/doc1``, you have to configure a route in Caddy:

.. code-block:: text

domain.com {

route /couchdb/* {
uri strip_prefix /couchdb
reverse_proxy localhost:5984
}

}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these two (out of three) empty lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the lines and appended the text a bit.
Also line 283 in chapter "Authentication with Caddy 2 as a reverse proxy" possibly contains a mistake when stating "This setup leans entirely on nginx performing...". I'm not sure if it is correct, or it should be "caddy" instead of "nginx", or if the paragraph has been erroneously copied from the identical paragraph in the nginx chapter at line 148 and was accidentally left, so I did not change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch! Looks like a copy/paste error. We would be pleased if you could fix this error at the same time and while you have a working caddy setup, can you test/evaluate the provided config samples if these are correct?


Reverse proxying + load balancing for CouchDB clusters
------------------------------------------------------

Expand Down