2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Reason: Spring-security is integrated. Websocket requests are intercepted and no logs are output (because the general spring-related log level is warn. There are too many logs in debug mode).
Then you can modify the undertow log level to view the log
- # 日志配置
- logging:
- level:
- com.cas.wict: debug
- org.springframework: warn
- org.springframework.web: debug
- io.undertow: debug
Key log output
- 2024-07-11 10:15:43.292 [XNIO-1 task-1] DEBUG io.undertow.request.security
- - Attempting to authenticate /ws, authentication required: false
- 2024-07-11 10:15:43.293 [XNIO-1 task-1] DEBUG io.undertow.request.security
- - Authentication outcome was NOT_ATTEMPTED with method io.undertow.security.impl.CachedAuthenticatedSessionMechanism@7fedbc60 for /ws
- 2024-07-11 10:15:43.293 [XNIO-1 task-1] DEBUG io.undertow.request.security
- - Authentication result was ATTEMPTED for /ws
It was found that the security might have intercepted the ws request path (why it was intercepted? I guess that although it was written as ws, it was still http when it was initiated, and was upgraded to websocket by the background)
Solution: Release the verification and write a separate filter to verify the ws request
Why was it possible to connect using netty-websocket before? That's because netty didn't use the filter chain of spring-security