1
0
Fork 0

fix: whitelist and XFF.

This commit is contained in:
Ludovic Fernandez 2018-05-30 09:26:03 +02:00 committed by Traefiker Bot
parent 8bca8236db
commit 6bcf45f136
3 changed files with 20 additions and 9 deletions

View file

@ -27,6 +27,14 @@ func TestIsAuthorized(t *testing.T) {
xForwardedForValues: []string{"1.2.3.1", "10.2.3.1"},
authorized: true,
},
{
desc: "allow UseXForwardedFor, remoteAddr not in range, UseXForwardedFor in range (compact XFF)",
whiteList: []string{"1.2.3.4/24"},
allowXForwardedFor: true,
remoteAddr: "10.2.3.1:123",
xForwardedForValues: []string{"1.2.3.1, 10.2.3.1"},
authorized: true,
},
{
desc: "allow UseXForwardedFor, remoteAddr in range, UseXForwardedFor in range",
whiteList: []string{"1.2.3.4/24"},