Fix 414 Too Large Request-URI
Ingress:
1
2
3
4
5
6
7
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
Spring Boot:
1
2
server:
max-http-header-size: 51200
Spring Cloud Gateway:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@Component
public class NettyConfig implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> {
/**
* 10m
*/
@Value("${server.max-initial-line-length:10485760}")
private int maxInitialLingLength;
@Override
public void customize(final NettyReactiveWebServerFactory factory) {
factory.addServerCustomizers(httpServer -> httpServer.httpRequestDecoder(httpRequestDecoderSpec -> {
httpRequestDecoderSpec.maxHeaderSize(maxInitialLingLength) ;
return httpRequestDecoderSpec;
}
));
}
}
