Closed anakhaaniejose closed 5 days ago
On further Analysis I found out that adding the headers "x-test" will cause error only when this code is added
.filters(f -> { return f.addRequestHeader("x-test", "bar"); })
So this must be an issue with Immutability of headers in the new version. Can someone take a look?
I'm unable to recreate the problem given the snippets above.
If you'd like us to spend some time investigating, please take the time to provide a complete, minimal, verifiable sample (something that we can unzip attached to this issue or git clone, build, and deploy) that reproduces the problem.
@spencergibb I'm providing the GitHub links to the applications I have used to reproduce the issue:
Please follow the following steps:
Start this application first, it will be started on 8081
Start this application, it will be started in 8082. I have coded it in such a way that endpoints will be called directly.
Starting the SpringCloudGateway can show the error I described earlier.
Interesting, going to httpbin.org there is no error, going to localhost there is. Actually, it was java 17 has the error, not java 21
Fortunately, upgrading to the latest spring boot snapshot fixes it because of https://github.com/spring-projects/spring-framework/issues/33666
@spencergibb Does this mean with spring-cloud gateway 4.2.0 and spring boot version 3.4.0 releases, this issue will be resolved?
Yes
Describe the bug I have a spring cloud gateway application that routes a request from port 8080 to s service at 8081. I have to try adding a header along with the request. So in postman I have added the headers "x-test" with value "foo" along with the request. This works perfectly fine till spring cloud gateway version 4.1.5. But when I change it to 4.2.0-M1, I'm getting this unsupportedoperation exception as given below:
I found that this issue is occuring only when I try to add a header. I tried comparing the calss HttpHeaders and few others with previous versions and current version and could bot find substantial changes.
Sample
Here is the code I used:
Class SpringCloudConfig
APIGatewayApplication
Application.properties
server.port=8080
pom.xml
this is the controller that provides the response for endpoint http://localhost:8081/employee/message
Can someone please take a look at this issue?