使用端点上下文处理Netty SSL异常

使用端点上下文处理Netty SSL异常,ssl,error-handling,netty,spring-webflux,Ssl,Error Handling,Netty,Spring Webflux,我们使用的是netty 4.1.31(通过spring-boot-starter-reactor-netty:jar:2.0.7) 我们的服务器正在使用双向SSL进行调用,并且可以正常工作。SSL是使用Spring引导配置的 由于我们需要SSL身份验证(server.SSL.client auth=NEED),因此每次客户端尝试使用不安全的HTTP访问端点时都会出现一个常规异常。例如: ERROR --- [ctor-http-nio-3] r.i.netty.channel.Closeable

我们使用的是
netty 4.1.31
(通过
spring-boot-starter-reactor-netty:jar:2.0.7

我们的服务器正在使用双向SSL进行调用,并且可以正常工作。SSL是使用Spring引导配置的

由于我们需要SSL身份验证(
server.SSL.client auth=NEED
),因此每次客户端尝试使用不安全的HTTP访问端点时都会出现一个常规异常。例如:

ERROR --- [ctor-http-nio-3] r.i.netty.channel.CloseableContextHandler  : Handler failure while no child channelOperation was present 
io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: ...
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1178) [netty-handler-4.1.31.Final.jar:4.1.31.Final]
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1243) [netty-handler-4.1.31.Final.jar:4.1.31.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502) [netty-codec-4.1.31.Final.jar:4.1.31.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441) [netty-codec-4.1.31.Final.jar:4.1.31.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278) [netty-codec-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:583) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:500) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) [netty-transport-4.1.31.Final.jar:4.1.31.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) [netty-common-4.1.31.Final.jar:4.1.31.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
如何自定义错误处理以记录与SSL异常相关的REST端点路径

我试图在
@RestController
级别天真地处理它,但它无法捕获它

@ExceptionHandler(NotSslRecordException.class)
public ResponseEntity<Void> exceptionHandler(NotSslRecordException ex) {
    ...
}
@ExceptionHandler(NotSslRecordException.class)
公共响应异常处理程序(NotSslRecordException ex){
...
}
我可能需要定制世界各地的某些部分,但不确定如何定制。有什么办法吗