Add trailing slash to jolokia context (#2105)

This commit is contained in:
Steven Pall 2016-12-17 07:51:46 -05:00 committed by Cameron Sparr
parent 6723ea5fe6
commit 0e8122a2fc
2 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,8 @@
# Read JMX metrics through Jolokia # Read JMX metrics through Jolokia
[[inputs.jolokia]] [[inputs.jolokia]]
## This is the context root used to compose the jolokia url ## 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 ## This specifies the mode used
# mode = "proxy" # mode = "proxy"

View File

@ -52,8 +52,9 @@ type Jolokia struct {
const sampleConfig = ` const sampleConfig = `
## This is the context root used to compose the jolokia url ## 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. ## NOTE that your jolokia security policy must allow for POST requests.
context = "/jolokia" context = "/jolokia/"
## This specifies the mode used ## This specifies the mode used
# mode = "proxy" # 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) { func (j *Jolokia) prepareRequest(server Server, metric Metric) (*http.Request, error) {
var jolokiaUrl *url.URL var jolokiaUrl *url.URL
context := j.Context // Usually "/jolokia" context := j.Context // Usually "/jolokia/"
// Create bodyContent // Create bodyContent
bodyContent := map[string]interface{}{ bodyContent := map[string]interface{}{