Skip to content
Open
Changes from all commits
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
20 changes: 18 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,22 @@ 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 and strip the subdirectory from the target URI with ``uri strip_prefix``:
Copy link
Contributor

@big-r81 big-r81 Jun 2, 2025

Choose a reason for hiding this comment

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

the linter complains about this long line. please add a line break (max. 90 chars).


.. code-block:: text

domain.com {

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

}

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

Expand Down