Skip to content

Commit 48cc477

Browse files
committed
Avoid roundtrip to Text when inspecting x-forwarded-for header
1 parent 08d3b8e commit 48cc477

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Network/HTTP/ReverseProxy.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ fixReqHeaders wps req =
362362
fromSocket = (("X-Real-IP", S8.pack $ showSockAddr $ WAI.remoteHost req):)
363363
fromForwardedFor = do
364364
h <- lookup "x-forwarded-for" (WAI.requestHeaders req)
365-
listToMaybe $ map (TE.encodeUtf8 . T.strip) $ T.splitOn "," $ TE.decodeUtf8 h
365+
listToMaybe $ map S8.strip $ S8.split ',' h
366366
addXRealIP =
367367
case wpsSetIpHeader wps of
368368
SIHFromSocket -> fromSocket

0 commit comments

Comments
 (0)