Skip to content

Commit 03c3ec1

Browse files
committed
Fall back on remoteHost if remoteAddress is null
See gh-35589
1 parent c88bfc5 commit 03c3ec1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ public InetSocketAddress getLocalAddress() {
220220

221221
@Override
222222
public InetSocketAddress getRemoteAddress() {
223-
return new InetSocketAddress(this.servletRequest.getRemoteAddr(), this.servletRequest.getRemotePort());
223+
String addressOrHost = this.servletRequest.getRemoteAddr();
224+
addressOrHost = (addressOrHost != null ? addressOrHost : this.servletRequest.getRemoteHost());
225+
return new InetSocketAddress(addressOrHost, this.servletRequest.getRemotePort());
224226
}
225227

226228
@Override

0 commit comments

Comments
 (0)