mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-07 16:58:16 +01:00
Add support for xff header in verbose web logger
This commit is contained in:
parent
1b26811c6a
commit
4141d21a70
@ -1,5 +1,6 @@
|
||||
package de.bluecolored.bluemap.common.web;
|
||||
|
||||
import de.bluecolored.bluemap.common.web.http.HttpHeader;
|
||||
import de.bluecolored.bluemap.common.web.http.HttpRequest;
|
||||
import de.bluecolored.bluemap.common.web.http.HttpRequestHandler;
|
||||
import de.bluecolored.bluemap.common.web.http.HttpResponse;
|
||||
@ -21,7 +22,14 @@ public LoggingRequestHandler(HttpRequestHandler delegate, Logger logger) {
|
||||
|
||||
@Override
|
||||
public HttpResponse handle(HttpRequest request) {
|
||||
String log = request.getSource() + " \""
|
||||
String source = request.getSource().toString();
|
||||
|
||||
HttpHeader xffHeader = request.getHeader("x-forwarded-for");
|
||||
if (xffHeader != null && !xffHeader.getValues().isEmpty()) {
|
||||
source = xffHeader.getValues().get(0);
|
||||
}
|
||||
|
||||
String log = source + " \""
|
||||
+ request.getMethod()
|
||||
+ " " + request.getAddress()
|
||||
+ " " + request.getVersion()
|
||||
|
Loading…
Reference in New Issue
Block a user