From 18d8625ab8216919d7788d990950de4dde3ce08a Mon Sep 17 00:00:00 2001 From: Steven Pall Date: Sat, 17 Dec 2016 07:51:46 -0500 Subject: [PATCH] Add trailing slash to jolokia context (#2105) --- plugins/inputs/jolokia/README.md | 3 ++- plugins/inputs/jolokia/jolokia.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/jolokia/README.md b/plugins/inputs/jolokia/README.md index 596dbed5fe2b4..d25ab6f461148 100644 --- a/plugins/inputs/jolokia/README.md +++ b/plugins/inputs/jolokia/README.md @@ -6,7 +6,8 @@ # Read JMX metrics through Jolokia [[inputs.jolokia]] ## This is the context root used to compose the jolokia url - context = "/jolokia" + ## NOTE that Jolokia requires a trailing slash at the end of the context root + context = "/jolokia/" ## This specifies the mode used # mode = "proxy" diff --git a/plugins/inputs/jolokia/jolokia.go b/plugins/inputs/jolokia/jolokia.go index 6a51e9b43f639..812e5e66b276f 100644 --- a/plugins/inputs/jolokia/jolokia.go +++ b/plugins/inputs/jolokia/jolokia.go @@ -52,8 +52,9 @@ type Jolokia struct { const sampleConfig = ` ## This is the context root used to compose the jolokia url + ## NOTE that Jolokia requires a trailing slash at the end of the context root ## NOTE that your jolokia security policy must allow for POST requests. - context = "/jolokia" + context = "/jolokia/" ## This specifies the mode used # mode = "proxy" @@ -148,7 +149,7 @@ func (j *Jolokia) doRequest(req *http.Request) (map[string]interface{}, error) { func (j *Jolokia) prepareRequest(server Server, metric Metric) (*http.Request, error) { var jolokiaUrl *url.URL - context := j.Context // Usually "/jolokia" + context := j.Context // Usually "/jolokia/" // Create bodyContent bodyContent := map[string]interface{}{