springcloud gateway出现 413Request Entity Too Large

springboot项目在yml中添加

server:
	max-http-header-size: 2MB

springcloud项目在gateway里添加

@Component
public class NettyConfiguration implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> {

    @Override
    public void customize(NettyReactiveWebServerFactory container) {
        container.addServerCustomizers(
                httpServer -> httpServer.httpRequestDecoder(
                        httpRequestDecoderSpec -> httpRequestDecoderSpec.maxHeaderSize(1000485760)
                )
        );
    }

}
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐