Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error max response HTTP Header Size on httpclient #369

Closed
jsanhc opened this issue Feb 18, 2021 · 2 comments
Closed

Error max response HTTP Header Size on httpclient #369

jsanhc opened this issue Feb 18, 2021 · 2 comments
Assignees
Labels
bug Something isn't working priority: high

Comments

@jsanhc
Copy link
Contributor

jsanhc commented Feb 18, 2021

Describe the bug

server:
  max-http-header-size: 10000000 # Required for the large signed JWT headers
  • We write the below component:
/**
 * This is required to support the large header sizes we use when signing payment file uploads
 */
@Component
public class WebServerConfig implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> {

    @Value("${server.max-http-header-size:165536}")
    private int maxHeaderSize;

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

}
  • But running the functional tests some tests and such as example the test PollAndAcknowledgeAggregatedPollingTest it's raise the below error:
{
  "timestamp": "2021-02-18T15:30:35.766+0000",
  "path": "/open-banking/v3.1.6/events",
  "status": 500,
  "error": "Internal Server Error",
  "message": "HTTP header is larger than 8192 bytes."
}

To Reproduce
Steps to reproduce the behaviour:

  1. run the test PollAndAcknowledgeAggregatedPollingTest against master.
  2. See error

Expected behaviour
No error.

Current behaviour
Error.

Workaround

  • We are using the version 2.1.1.RELEASE of spring cloud gateway.
  • Upgrade spring cloud gateway to 2.15.RELEASE where seems to be fixed.
  • See commit 64a579d

Code analysis

  • The error it's raise because the max header size set in the configuration it's being applied only for the request httpRequestDecoderSpec and not for the response httpResponseDecoderSpec and when the httpObjectDecoder.HeaderParser#process runs with the default value max header size 8192 bytes.
  • Seems a bug in spring boot cloud gateway

Release Notes

Affected App: Gateway app.

@jsanhc jsanhc self-assigned this Feb 18, 2021
@jsanhc jsanhc added bug Something isn't working priority: high labels Feb 18, 2021
@jsanhc
Copy link
Contributor Author

jsanhc commented Feb 19, 2021

Implemented Solution

  • Upgraded spring cloud version Greenwich.SR1 to Greenwich.SR6 in openbanking-parent this latest spring cloud version have the dependency version 2.1.5 of gateway-core with the fix to set the max header size as a httpClient property for responses.
  • Added max-header-size property in the application.yml file in reference-implementation/openbanking-config.
#Spring cloud config
spring:
  ...
  cloud:
    ...
      ...
    gateway:
      httpclient:
        max-header-size: 10000000 # The max response header size, Required for the large signed JWT headers

Check projects openbanking-parent pom integrity after upgrade spring-cloud framework to Greenwich.SR6 to fix max header size on the response (HttpClient)

jsanhc added a commit that referenced this issue Feb 22, 2021
…ponse

- Bumped latest release version of dependencies
- Updated application.yml config app to support the scope "eventpolling"
Issues:
- OpenBankingToolkit/openbanking-aspsp#327
- #369
jsanhc added a commit that referenced this issue Feb 22, 2021
…ponse (#370)

- Bumped latest release version of dependencies
- Updated application.yml config app to support the scope "eventpolling"
Issues:
- OpenBankingToolkit/openbanking-aspsp#327
- #369
@jsanhc jsanhc closed this as completed Apr 7, 2021
@svankamamidi
Copy link

Implemented Solution

  • Upgraded spring cloud version Greenwich.SR1 to Greenwich.SR6 in openbanking-parent this latest spring cloud version have the dependency version 2.1.5 of gateway-core with the fix to set the max header size as a httpClient property for responses.
  • Added max-header-size property in the application.yml file in reference-implementation/openbanking-config.
#Spring cloud config
spring:
  ...
  cloud:
    ...
      ...
    gateway:
      httpclient:
        max-header-size: 10000000 # The max response header size, Required for the large signed JWT headers

Check projects openbanking-parent pom integrity after upgrade spring-cloud framework to Greenwich.SR6 to fix max header size on the response (HttpClient)

this solution is not working for us. We are using Spring Boot 2.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high
Projects
None yet
Development

No branches or pull requests

2 participants