playframework / play1

Play framework
https://www.playframework.com/documentation/1.4.x/home
Other
1.58k stars 683 forks source link

Play 1.7 WS problem (header too large) #1434

Open qabi opened 1 year ago

qabi commented 1 year ago

Are you looking for help?

Requests made through WS do not support response headers longer than 8152 bytes. Some web servers return such long headers.

Netty allows to configure this, but it does not seem to be possible to configure through Play!

Play Version (1.5.x / etc)

1.7.1

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacOS and Ubuntu.

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

JDK 17.0.1

rakix commented 1 year ago

It might work if you fix framework/src/play/libs/ws/WSAsync.java Constructor

+        if (Play.configuration.containsKey("http.clientMaxHeaderSize")){
+            int clientMaxHeaderSize = Integer.valueOf(Play.configuration.getProperty("http.clientMaxHeaderSize"));
+            NettyAsyncHttpProviderConfig providerConfig = new NettyAsyncHttpProviderConfig();
+            providerConfig.setHttpClientCodecMaxHeaderSize(clientMaxHeaderSize);
+            confBuilder.setAsyncHttpClientProviderConfig(providerConfig);
+        }
qabi commented 1 year ago

Thanks!

That is essentially what I have done, but with reflection from a subclass, so WSAsync did not have to be copied entirely.

Not a very nice fix, but it works :)