question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zuul returns "400 Bad Request" randomly for chunked responses

See original GitHub issue

Hey! Sending a PUT request to an API through Zuul returns 400 Bad Request randomly. If I send the same request directly to the API behind, it always works returning 200 OK, but if the request goes through Zuul, it sometimes returns 200 OK, sometimes fails.

Analyzing packages with tcpdump shows an strange behaviour of one http request receiving two http responses, which it shouldn’t happen at all.

The API behind zuul is an Spring Boot application returning a Single object, and it sends chunks responses to Zuul. I’ve reproduced the same issue with this endpoint.

inputStream is reading a JSON file from the server to simulate the response. With this code, we get a 400 Bad Request one on every 10-15 requests. It also looks like if the inputStream reads a small file, no error is shown, but if the file goes above some bytes, it starts happening.

Any help?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
18099538715commented, Aug 21, 2017

I met this because I have wrote my own filter, In my filter I change the body size ,then the real content-length is not equals to the value in head.

1reaction
dgomezscommented, Jan 25, 2017

hey @sokie

This is the config I have and that has been working for me.

def springBootRelease = "1.4.1.RELEASE"

dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Camden.SR1'
    }
}

dependencies {

    // tag::jetty[]
    compile (group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootRelease) {
        exclude module: "spring-boot-starter-tomcat"
    }

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-jetty', version: springBootRelease

    // end::jetty[]

    // tag::actuator[]
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: springBootRelease
    // end::actuator[]

    compile 'org.springframework.cloud:spring-cloud-security:1.1.3.RELEASE'

    compile 'org.springframework.cloud:spring-cloud-starter-zuul:1.2.1.RELEASE'
    compile 'org.springframework.cloud:spring-cloud-starter-security:1.1.3.RELEASE'
    compile 'org.springframework.security.oauth:spring-security-oauth2:2.0.11.RELEASE'
    compile "org.springframework.security:spring-security-jwt:1.0.5.RELEASE"

}

I hope it helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting 400 bad request Error from apache Http client in Zuul ...
It is working as expected but I am facing an intermittent issue where for some request I am getting 400 bad request error...
Read more >
Spring Cloud Netflix
The Spring Cloud DiscoveryClient will always return a URI starting with https for ... in a Spring Boot application, so the random value...
Read more >
HTTP Request Smuggling - Application Security Cheat Sheet
If this is a request message, the server MUST respond with a 400 (Bad Request) status code and then close the connection. If...
Read more >
Changelog - curl
curl.h: fix mention of wrong error code in comment; curl/add_file_name_to_url: use the libcurl URL parser · curl/add_parallel_transfers: better ...
Read more >
Solved: 400: Bad Request : The request could not be comple...
I have given all the required tags as per API Doc. However geting the error "The request could not be completed due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found