willholley opened a new pull request, #5983:
URL: https://github.com/apache/couchdb/pull/5983

   <!-- Thank you for your contribution!
   
        Please file this form by replacing the Markdown comments
        with your text. If a section needs no action - remove it.
   
        Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
        of code collaboration. Positive feedback is represented +1 from 
committers
        and negative is a -1. The -1 also means veto, and needs to be addressed
        to proceed. Once there are no objections, the PR can be merged by a
        CouchDB committer.
   
        See: http://couchdb.apache.org/bylaws.html#decisions for more info.
   
        Artificial Intelligence and Large Language Models Contributions Policy
   
        It is expressly forbidden to contribute material generated by
        AI, LLMs, and similar technologies, to the CouchDB project. 
        This includes, but is not limited to, source code, documentation,
        commit messages, or any other areas of the project.
   
   -->
   
   ## Overview
   
   This adds a feature to the CouchDB replicator to override the DNS target for 
specific host
   patterns (including wildcards) when making outbound requests. The use case 
is when requests need to be routed via a transparent SNI proxy e.g. for network 
egress monitoring.
   
   There is adds a new configuration option to specify the overrides:
   
   ```
   [replicator]
   dns_overrides = host:target, host2:target
   ```
   
   The replicator resolves the configured host patterns to the alternative 
connection targets while
   preserving the request URL host (applies to regular requests and 
session-auth requests).
   
   Note this depends on the 
[`connect_to`](https://github.com/apache/couchdb-ibrowse/pull/9) option in 
ibrowse, which is a custom feature in the CouchDB ibrowse fork.
   
   ## Testing recommendations
   
   Testing this is a bit involved as it relies on setting up an SNI proxy. I 
did it using `nginx` in docker with the configuration attached to proxy to a 
cloudant.com database. The proxy was running on a non-standard port (e.g. 8443) 
so that any replications connecting directly to cloudant.com would fail.
   
   I then set `dns_overrides = *.cloudant.com:127.0.0.1` in default.ini and 
configured a replication from `myaccount.cloudant.com:8443/mydb`. The test 
succeeds if the proxy logged the connection and the replication completed.
   
   
[nginx.conf.zip](https://github.com/user-attachments/files/27130311/nginx.conf.zip)
   
   
   ## Related Issues or Pull Requests
   
    * https://github.com/apache/couchdb-ibrowse/pull/9
   
   ## Checklist
   
   - [x] This is my own work, I did not use AI, LLM's or similar technology
   - [x] Code is written and works correctly
   - [x] Changes are covered by tests
   - [x] Any new configurable parameters are documented in 
`rel/overlay/etc/default.ini`
   - [x] Documentation changes were made in the `src/docs` folder
   - [ ] Documentation changes were backported (separated PR) to affected 
branches
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to