File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,9 @@ def GET(self, **params):
113
113
'''
114
114
resp = []
115
115
116
+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
116
117
conn = cherrypy .request .headers .get ('Host' ).split (':' )
117
- if int (conn [1 ]) != int (self .attr .get ('prometheus' )):
118
+ if len ( conn ) == 2 and int (conn [1 ]) != int (self .attr .get ('prometheus' )):
118
119
self .logger .error (MSG ['EndpointNotSupportedForPort' ].
119
120
format (cherrypy .request .script_name , str (conn [1 ])))
120
121
raise cherrypy .HTTPError (400 , ERR [400 ])
Original file line number Diff line number Diff line change @@ -281,8 +281,9 @@ def GET(self, **params):
281
281
"""
282
282
resp = []
283
283
284
+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
284
285
conn = cherrypy .request .headers .get ('Host' ).split (':' )
285
- if int (conn [1 ]) != int (self .port ):
286
+ if len ( conn ) == 2 and int (conn [1 ]) != int (self .port ):
286
287
self .logger .error (MSG ['EndpointNotSupportedForPort' ].
287
288
format (cherrypy .request .script_name , str (conn [1 ])))
288
289
raise cherrypy .HTTPError (400 , ERR [400 ])
@@ -327,6 +328,13 @@ def POST(self):
327
328
''' Process POST. tools.json_in.force is set to False for
328
329
compatability between versions of grafana < 3 and version 3.'''
329
330
331
+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
332
+ conn = cherrypy .request .headers .get ('Host' ).split (':' )
333
+ if len (conn ) == 2 and int (conn [1 ]) != int (self .port ):
334
+ self .logger .error (MSG ['EndpointNotSupportedForPort' ].
335
+ format (cherrypy .request .script_name , str (conn [1 ])))
336
+ raise cherrypy .HTTPError (400 , ERR [400 ])
337
+
330
338
# /api/query
331
339
if 'query' in cherrypy .request .script_name :
332
340
Original file line number Diff line number Diff line change @@ -149,8 +149,9 @@ def GET(self, **params):
149
149
'''
150
150
resp = []
151
151
152
+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
152
153
conn = cherrypy .request .headers .get ('Host' ).split (':' )
153
- if int (conn [1 ]) != int (self .port ):
154
+ if len ( conn ) == 2 and int (conn [1 ]) != int (self .port ):
154
155
self .logger .error (MSG ['EndpointNotSupportedForPort' ].
155
156
format (cherrypy .request .script_name , str (conn [1 ])))
156
157
raise cherrypy .HTTPError (400 , ERR [400 ])
You can’t perform that action at this time.
0 commit comments