Details
Description
By default, curl and libcurl will honour the http_proxy environment variable, and attempt to use the proxy as defined. In Couchbase Server this affects moxi (via libconflate) and cbcollect_info (when fetching http://127.0.0.1:8091/diag?noLogs=1 with curl).
To test, run python -m SimpleHTTPServer on an IP address that Couchbase Server can connect to. This won't act as a proxy, but will provide similar results (i.e. the request will 404), and we can log the attempts that are being made.
moxi
To ensure the http_proxy variable is definitely set, edit /opt/couchbase/bin/couchbase-server:
[root@localhost vagrant]# cat /vagrant/couchbase-server.patch
|
--- /opt/couchbase/bin/couchbase-server.orig 2015-06-14 06:13:46.000000000 +0000
|
+++ /opt/couchbase/bin/couchbase-server 2015-06-23 13:24:48.165222779 +0000
|
@@ -136,6 +136,9 @@
|
|
|
_start() {
|
+ http_proxy=192.168.46.1:8000
|
+ export http_proxy
|
+
|
_check_nofile
|
_prepare_datadir
|
_maybe_start_epmd
|
Restart couchbase-server and the following should appear in the terminal window where the HTTPServer is running:
192.168.46.101 - - [23/Jun/2015 14:38:34] code 404, message File not found
|
192.168.46.101 - - [23/Jun/2015 14:38:34] "GET http://127.0.0.1:8091/pools/default/saslBucketsStreaming HTTP/1.1" 404 -
|
And the following in the babysitter logs:
[ns_server:info,2015-06-23T13:38:34.287Z,babysitter_of_ns_1@127.0.0.1:<0.78.0>:ns_port_server:log:210]moxi<0.78.0>: 2015-06-23 13:38:34: (/home/couchbase/jenkins/workspace/sherlock-unix/moxi/src/cproxy_config.c.327) env: MOXI_SASL_PLAIN_USR (5)
|
moxi<0.78.0>: 2015-06-23 13:38:36: (/home/couchbase/jenkins/workspace/sherlock-unix/moxi/src/agent_config.c.431) ERROR: parse JSON failed, from REST server: http://127.0.0.1:8091/pools/default/saslBucketsStreaming, <head>
|
moxi<0.78.0>: <title>Error response</title>
|
moxi<0.78.0>: </head>
|
moxi<0.78.0>: <body>
|
moxi<0.78.0>: <h1>Error response</h1>
|
moxi<0.78.0>: <p>Error code 404.
|
moxi<0.78.0>: <p>Message: File not found.
|
moxi<0.78.0>: <p>Error code explanation: 404 = Nothing matches the given URI.
|
moxi<0.78.0>: </body>
|
moxi<0.78.0>:
|
cbcollect_info
Run cbcollect_info as:
http_proxy=http://192.168.46.1:8000 /opt/couchbase/bin/cbcollect_info /path/to/cbcollect_info.zip
The HTTPServer should show:
192.168.46.101 - - [23/Jun/2015 14:51:24] code 404, message File not found
|
192.168.46.101 - - [23/Jun/2015 14:51:24] "GET http://127.0.0.1:8091/diag?noLogs=1 HTTP/1.1" 404 -
|
And the diag.log in cbcollect_info.zip should look like:
==============================================================================
|
couchbase diags
|
curl -sS -u :***** http://127.0.0.1:8091/diag?noLogs=1
|
==============================================================================
|
<head>
|
<title>Error response</title>
|
</head>
|
<body>
|
<h1>Error response</h1>
|
<p>Error code 404.
|
<p>Message: File not found.
|
<p>Error code explanation: 404 = Nothing matches the given URI.
|
</body>
|