nickva commented on code in PR #6063:
URL: https://github.com/apache/couchdb/pull/6063#discussion_r3616289611
##########
src/docs/src/config/http.rst:
##########
@@ -288,6 +288,16 @@ HTTP Server Options
[chttpd]
disconnect_check_jitter_msec = 15000
+ .. config:option:: peer_header :: Header to use for peer
+
+ .. versionadded:: 3.5.3
+
+ If defined, CouchDB will use the value of this request header to
determine peer.
Review Comment:
Maybe add a node that only valid IPs will be considered
##########
src/couch/src/couch_httpd.erl:
##########
@@ -1425,6 +1425,20 @@ http_respond_(#httpd{mochi_req = MochiReq}, Code,
Headers, Args, Type) ->
MochiReq:Type({Code, Headers, Args}).
peer(MochiReq) ->
+ case config:get("chttpd", "peer_header") of
+ undefined ->
+ peer_from_socket(MochiReq);
+ PeerHeader ->
+ Peer = MochiReq:get_header_value(PeerHeader),
+ case inet:parse_address(Peer) of
+ {ok, _} ->
+ Peer;
Review Comment:
May not matter except for logging/tracing but we could normalize it back to
a string and return `inet:ntoa(IpAddr)` so then "127.1", "127.0.0.01" and
"127.0.0.1" will be the same key.
--
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]