Search code examples
javaspringspring-bootwildflyhttpd.conf

502 Proxy | Who is culprit Wildfly or Spring Boot or Httpd? | Invalid response from an upstream server


We are not sure whether it is Wildfly Server, Spring Boot app, HTTPD or anything else?

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>

<head>
    <title>502 Proxy Error</title>
</head>

<body>
    <h1>Proxy Error</h1>
    <p>The proxy server received an invalid
        response from an upstream server.<br />
The proxy server could not handle the request
        <em><a href="/terp-offerings-rest-0.0.1-SNAPSHOT-wildfly10/offerings/all">GET&nbsp;/terp-offerings-rest-0.0.1-SNAPSHOT-wildfly10/offerings/all</a></em>.
        <p>
            Reason: <strong>Error reading from remote server</strong></p>
    </p>
</body>

</html>

Request goes and in 2 minutes it tries to fetch response from db but in 1 minute client end gets proxy error.

In Spring Boot I did following:

@GetMapping("/offerings/all")
@Transactional(timeout = 600000)
public List<XxtoneOfferingsV> getAllOfferings(){

and

spring.mvc.async.request-timeout=600000

But in vain same error.

Following i tried in wildfly:

Profile -> servergroup -> Undertow -> Server -> AJP/HTTP/HTTPS (Changed norequesttimeout to 600000 and readtimeout to 600000

Got nothing....


Solution

  • Along with above mentioned settings

    Added following to HTTPD.CONF

    Timeout 300
    ProxyTimeout 300
    ProxyBadHeader Ignore 
    

    And it worked successfully.