{"action":"created","issue":{"url":"https://api.github.com/repos/kr1sp1n/node-vault/issues/23","repository_url":"https://api.github.com/repos/kr1sp1n/node-vault","labels_url":"https://api.github.com/repos/kr1sp1n/node-vault/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/kr1sp1n/node-vault/issues/23/comments","events_url":"https://api.github.com/repos/kr1sp1n/node-vault/issues/23/events","html_url":"https://github.com/kr1sp1n/node-vault/issues/23","id":159240850,"number":23,"title":"Follow all redirects with request","user":{"login":"crazed","id":173786,"avatar_url":"https://avatars.githubusercontent.com/u/173786?v=3","gravatar_id":"","url":"https://api.github.com/users/crazed","html_url":"https://github.com/crazed","followers_url":"https://api.github.com/users/crazed/followers","following_url":"https://api.github.com/users/crazed/following{/other_user}","gists_url":"https://api.github.com/users/crazed/gists{/gist_id}","starred_url":"https://api.github.com/users/crazed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crazed/subscriptions","organizations_url":"https://api.github.com/users/crazed/orgs","repos_url":"https://api.github.com/users/crazed/repos","events_url":"https://api.github.com/users/crazed/events{/privacy}","received_events_url":"https://api.github.com/users/crazed/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-08T18:37:55Z","updated_at":"2016-07-06T21:56:53Z","closed_at":"2016-07-06T21:56:53Z","body":"When running vault in HA mode, you must follow redirects on PUT/POST/DELETE. By default the `request` module only follows redirects for GET requests. To enable this you just have to set `followAllRedirects` to `true` when making a request. Only work around I see at the moment is to monkey patch the `_request` method:\r\n\r\n```\r\n  vault._request = function(opts, done) {\r\n      debug(opts);\r\n    var uri;\r\n    if (opts == null) {\r\n      opts = {};\r\n    }\r\n    uri = this.endpoint + \"/\" + this.apiVersion + opts.path;\r\n    uri = this.mustache.render(uri, opts.json);\r\n    uri = uri.replace(/&#x2F;/g, '/');\r\n    debug(opts.method + \" \" + uri);\r\n    if (!opts['headers']) {\r\n      opts.headers = {};\r\n    }\r\n    if (this.token != null) {\r\n      opts.headers['X-Vault-Token'] = this.token;\r\n    }\r\n    opts.uri = uri;\r\n    opts.followAllRedirects = true;\r\n    return this.request(opts, function(err, res, body) {\r\n      if (err) {\r\n        debug(err);\r\n        return done(err);\r\n      }\r\n      debug(\"RES \" + (res != null ? res.statusCode : void 0));\r\n      if (body) {\r\n        if (typeof body !== 'object') {\r\n          body = JSON.parse(body);\r\n        }\r\n        debug(body);\r\n      }\r\n      return done(err, res, body);\r\n    });\r\n  };\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/kr1sp1n/node-vault/issues/comments/230919564","html_url":"https://github.com/kr1sp1n/node-vault/issues/23#issuecomment-230919564","issue_url":"https://api.github.com/repos/kr1sp1n/node-vault/issues/23","id":230919564,"user":{"login":"kr1sp1n","id":64247,"avatar_url":"https://avatars.githubusercontent.com/u/64247?v=3","gravatar_id":"","url":"https://api.github.com/users/kr1sp1n","html_url":"https://github.com/kr1sp1n","followers_url":"https://api.github.com/users/kr1sp1n/followers","following_url":"https://api.github.com/users/kr1sp1n/following{/other_user}","gists_url":"https://api.github.com/users/kr1sp1n/gists{/gist_id}","starred_url":"https://api.github.com/users/kr1sp1n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kr1sp1n/subscriptions","organizations_url":"https://api.github.com/users/kr1sp1n/orgs","repos_url":"https://api.github.com/users/kr1sp1n/repos","events_url":"https://api.github.com/users/kr1sp1n/events{/privacy}","received_events_url":"https://api.github.com/users/kr1sp1n/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T21:56:53Z","updated_at":"2016-07-06T21:56:53Z","body":"@crazed Thanks for the hint. But it was already possible to pass a `requestOptions` key to any vault method.\r\nSee https://github.com/kr1sp1n/node-vault/blob/a168210eae75ba705beb4534de0d2bff1eec5e0b/example/auth.js for an example."}}
{"actor":{"display_login":"kr1sp1n"}}