Skip to content

Commit 34de465

Browse files
authored
feat(events): add information on X-Forwarded-For header (#907)
Describe the event structure if a reverse proxy is involved.
1 parent 3b28b18 commit 34de465

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

events/loginattempt.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,36 @@ LoginAttempt
33

44
When authentication is enabled for the GUI, this event is emitted on every
55
login attempt. If either the username or password are incorrect, ``success``
6-
is false and in any case the given username is returned. The included
7-
remote address concerns the immediate connecting host, which may not be the
8-
origin of the request, but e.g. a reverse proxy.
6+
is false and in any case the given username is returned.
97

108
.. code-block:: json
119
1210
{
1311
"id" : 187,
1412
"time" : "2017-03-07T00:19:24.420386143+01:00",
1513
"data" : {
16-
"remoteAddress" : "127.0.0.1:55530",
14+
"remoteAddress" : "127.0.0.1",
15+
"username" : "somename",
16+
"success" : false
17+
},
18+
"type" : "LoginAttempt",
19+
"globalID" : 195
20+
}
21+
22+
If the ``X-Forwared-For`` header is present and the connecting host is
23+
either on ``localhost`` or on the same LAN, it will be treated as a reverse
24+
proxy. In this case, the ``remoteAddress`` field is filled with the leftmost
25+
IP address from the header, and the additional ``proxy`` field retains the
26+
original IP of the connecting host.
27+
28+
.. code-block:: json
29+
30+
{
31+
"id" : 187,
32+
"time" : "2017-03-07T00:19:24.420386143+01:00",
33+
"data" : {
34+
"proxy" : "127.0.0.1",
35+
"remoteAddress" : "192.168.178.10",
1736
"username" : "somename",
1837
"success" : false
1938
},

0 commit comments

Comments
 (0)