Skip to content

Commit f641606

Browse files
committed
If the request is invalid (ie I don't have the parameters I expect) the getRemoteAddr method return the localhost address (#182)
1 parent 7336e30 commit f641606

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ public BufferedReader getReader()
584584

585585
@Override
586586
public String getRemoteAddr() {
587+
if (request.getRequestContext() == null || request.getRequestContext().getIdentity() == null) {
588+
return "127.0.0.1";
589+
}
587590
return request.getRequestContext().getIdentity().getSourceIp();
588591
}
589592

0 commit comments

Comments
 (0)