我正在一个Sping Boot 项目中工作,我有一个返回网关超时504的请求。我可以增加此超时吗?这是我可以在standalone-full.xml中更改的属性吗?我正在使用wildfly服务器。该请求在1分钟内触发两次,始终在1分钟内触发。
hgb9j2n61#
希望这能帮上忙。
public HttpClient getBasicAuthDefaultHttpClient() { CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials creds = new UsernamePasswordCredentials(user, password); provider.setCredentials(AuthScope.ANY, creds); //Fix to avoid HTTP 504 ERROR (GATEWAY TIME OUT ERROR) RequestConfig.Builder requestBuilder = RequestConfig.custom(); requestBuilder.setConnectTimeout(30 * 1000); requestBuilder.setConnectionRequestTimeout(30 * 1000); HttpClientBuilder builder = HttpClientBuilder.create(); builder.setDefaultRequestConfig(requestBuilder.build()); builder.setDefaultCredentialsProvider(provider).build(); return builder.build(); }
1条答案
按热度按时间hgb9j2n61#
希望这能帮上忙。