Получение ошибки прокси 502, когда один сервер вызывает другой сервер, используя rest api клиентского объекта javaee-api, как показано ниже:
Эта ошибка выдается через 2 минуты.
javax.ws.rs.client.Client;
javax.ws.rs.client.ClientBuilder
I am using : Client client = ClientBuilder.newClient();
target = client.target(restWsUrl);
target.path("somepath").request().header(someheaders).accept(APPLICATION_JSON).get();
I notice after 2 minutes , i am getting following error .
<!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="/white_page-2/api/cna-records/num-shared/ip">GET /white_page-2/api/cna-records/num-shared/ip</a></em>.<p>
Reason: <strong>Error reading from remote server</strong></p></p>
</body></html>
]]
I have tried adding timeouts to client object like following :
client.property(HTTP_CONNECTION_TIMEOUT, 240000);
client.property(HTTP_RECEIVE_TIMEOUT, 240000);
or
client.property(JERSEY_CONFIG_CLIENT_CONNECT_TIMEOUT, 240000);
client.property(JERSEY_CONFIG_CLIENT_READ_TIMEOUT, 240000);
or
client.property("javax.xml.ws.client.connectionTimeout", 300000);
client.property("javax.xml.ws.client.receiveTimeout", 300000);
But none seems to increase the timeout . It still crashes with 502 proxy after 2 minutes.
Есть идеи, как исправить эту ошибку 502 прокси.