Skip to content

Node-etcd automatically use the environment variable http_proxy, how to avoid #72

Description

@ace-express

my code:

const Etcd = require("node-etcd");

const etcd = new Etcd("http://127.0.0.1:2379");

etcd.version(console.log);

req.proxy is :
{
"protocol": "http:",
"slashes": true,
"auth": null,
"host": "127.0.0.1:1235",
"port": "1235",
"hostname": "127.0.0.1",
"hash": null,
"search": null,
"query": null,
"pathname": "/",
"path": "/",
"href": "http://127.0.0.1:1235/"
}

my .zshrc

export http_proxy=http://127.0.0.1:1235
export https_proxy=http://127.0.0.1:1235

etcdctl can be used normally.
cause proxy i get this error:

{ Error: All servers returned error
    at Client._error (/Users/eric/dev/configuration-center/node_modules/node-etcd/lib/client.js:198:13)
    at Client._multiserverHelper (/Users/eric/dev/configuration-center/node_modules/node-etcd/lib/client.js:121:19)
    at Client._multiserverHelper (/Users/eric/dev/configuration-center/node_modules/node-etcd/lib/client.js:3:57)
    at Request._callback (/Users/eric/dev/configuration-center/node_modules/node-etcd/lib/client.js:137:24)
    at Request.self.callback (/Users/eric/dev/configuration-center/node_modules/request/request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/Users/eric/dev/configuration-center/node_modules/request/request.js:1171:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
  errors: 
   [ { server: 'http://127.0.0.1:2379',
       httperror: null,
       httpstatus: 503,
       httpbody: '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n<html><head>\n<meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">\n<title>ERROR: The requested URL could not be retrieved</title>\n<style type="text/css"><!-- \n /*\n Stylesheet for Squid Error pages\n Adapted from design by Free CSS Templates\n http://www.freecsstemplates.org\n Released for free under a Creative Commons Attribution 2.5 License\n*/\n\n/* Page basics */\n* {\n\tfont-family: verdana, sans-serif;\n}\n\nhtml body {\n\tmargin: 0;\n\tpadding: 0;\n\tbackground: #efefef;\n\tfont-size: 12px;\n\tcolor: #1e1e1e;\n}\n\n/* Page displayed title area */\n#titles {\n\tmargin-left: 15px;\n\tpadding: 10px;\n\tpadding-left: 100px;\n\tbackground: url(\'http://www.squid-cache.org/Artwork/SN.png\') no-repeat left;\n}\n\n/* initial title */\n#titles h1 {\n\tcolor: #000000;\n}\n#titles h2 {\n\tcolor: #000000;\n}\n\n/* special event: FTP success page titles */\n#titles ftpsuccess {\n\tbackground-color:#00ff00;\n\twidth:100%;\n}\n\n/* Page displayed body content area */\n#content {\n\tpadding: 10px;\n\tbackground: #ffffff;\n}\n\n/* General text */\np {\n}\n\n/* error brief description */\n#error p {\n}\n\n/* some data which may have caused the problem */\n#data {\n}\n\n/* the error message received from the system or other software */\n#sysmsg {\n}\n\npre {\n    font-family:sans-serif;\n}\n\n/* special event: FTP / Gopher directory listing */\n#dirmsg {\n    font-family: courier;\n    color: black;\n    font-size: 10pt;\n}\n#dirlisting {\n    margin-left: 2%;\n    margin-right: 2%;\n}\n#dirlisting tr.entry td.icon,td.filename,td.size,td.date {\n    border-bottom: groove;\n}\n#dirlisting td.size {\n    width: 50px;\n    text-align: right;\n    padding-right: 5px;\n}\n\n/* horizontal lines */\nhr {\n\tmargin: 0;\n}\n\n/* page displayed footer area */\n#footer {\n\tfont-size: 9px;\n\tpadding-left: 10px;\n}\n\n\nbody\n:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }\n:lang(he) { direction: rtl; }\n --></style>\n</head><body id=ERR_CONNECT_FAIL>\n<div id="titles">\n<h1>ERROR</h1>\n<h2>The requested URL could not be retrieved</h2>\n</div>\n<hr>\n\n<div id="content">\n<p>The following error was encountered while trying to retrieve the URL: <a href="http://127.0.0.1:2379/version">http://127.0.0.1:2379/version</a></p>\n\n<blockquote id="error">\n<p><b>Connection to 127.0.0.1 failed.</b></p>\n</blockquote>\n\n<p id="sysmsg">The system returned: <i>(111) Connection refused</i></p>\n\n<p>The remote host or network may be down. Please try the request again.</p>\n\n<p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;body=CacheHost%3A%20gfw-hk-ali03%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(111)%20Connection%20refused%0D%0ATimeStamp%3A%20Wed,%2014%20Jun%202017%2005%3A43%3A18%20GMT%0D%0A%0D%0AClientIP%3A%20127.0.0.1%0D%0AServerIP%3A%20127.0.0.1%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fversion%20HTTP%2F1.1%0AAccept%3A%20application%2Fjson%0D%0AProxy-Authorization%3A%20Basic%20bGl1ZmVuZ3NvZnQ6ZzI4NXE1NnpxOA%3D%3D%0D%0AX-Forwarded-For%3A%20120.76.55.21%0D%0AHost%3A%20127.0.0.1%3A2379%0D%0A%0D%0A%0D%0A">webmaster</a>.</p>\n\n<br>\n</div>\n\n<hr>\n<div id="footer">\n<p>Generated Wed, 14 Jun 2017 05:43:18 GMT by gfw-hk-ali03 (squid/3.3.8)</p>\n<!-- ERR_CONNECT_FAIL -->\n</div>\n</body></html>\n',
       response: [Object],
       timestamp: 2017-06-14T05:43:18.965Z } ],
  retries: 0 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions