Commit 7c45f84
authored
Reject invalid HTTP methods and resources (#1019)
This change addresses the issue that currently, any HTTP method is handled
by returning success and metrics data, which causes network scanners to
report issues.
Details:
* This change rejects any HTTP methods and resources other than the following:
OPTIONS (any) - returns 200 and an 'Allow' header indicating allowed methods
GET (any) - returns 200 and metrics
GET /favicon.ico - returns 200 and no body (this is no change)
Other HTTP methods than these are rejected with 405 "Method Not Allowed"
and an 'Allow' header indicating the allowed HTTP methods.
Any returned HTTP errors are also displayed in the response body after a
hash sign and with a brief hint,
e.g. "# HTTP 405 Method Not Allowed: XXX; use OPTIONS or GET".
Signed-off-by: Andreas Maier <[email protected]>1 parent 09a5ae3 commit 7c45f84
File tree
2 files changed
+33
-2
lines changed- docs/content/exporting/http
- prometheus_client
2 files changed
+33
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| 137 | + | |
| 138 | + | |
127 | 139 | | |
128 | 140 | | |
129 | 141 | | |
| |||
0 commit comments