Skip to content

All SockJS fallback options fail if request.getRemotePort() is not forwarded by proxy [SPR-14295] #18867

@spring-projects-issues

Description

@spring-projects-issues

Gottfried Huber opened SPR-14295 and commented

If the request's remote port is not available (-1), all SockJS fallback strategies fail in

org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.handleInitialRequest(ServerHttpRequest, ServerHttpResponse, SockJsFrameFormat)

at this line:

this.remoteAddress = request.getRemoteAddress();

This is because the InetSocketAddress constructor checks the port argument and throws an IllegalArgumentException if the value is not between 0 and 0xFFFF

We have this issue with an apache httpd proxy load-balancing to tomcat 8 instances via AJP. Apache would require the lates mod_jk 1.2.32 to support remotePort forwarding.

See https://tomcat.apache.org/connectors-doc/common_howto/proxy.html

I know that the issue could be resolved by updating apache. But I think the whole point of using sockJS is to provide a fool proof websocket emulation for unsupportive browsers and proxies.

Our proxy works fine with standard http traffic, and it certainly would support XHR-Streaming fallback, if just this initialRequest handling would not fail.

As far as I can see this remote address is not used anywhere for the polling streaming options.


Affects: 4.2.1, 4.3 RC2

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions