0

I'm facing a weird issue with an Api Call inside my spring boot application. When I use restTemplate to call an API :

ResponseEntity<String> response;

HttpHeaders headers = new HttpHeaders();
headers.set("X-Api-Key", "blablabla");
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
HttpEntity entity = new HttpEntity(headers);

try {
      response = restTemplate.exchange(uri, HttpMethod.GET, entity, String.class);
} catch (HttpClientErrorException e) {
      throw new HttpClientErrorException(e.getStatusCode());
}

I can't have any response of the called API. It always returns a 200 Http Status but the following body :

<200 OK,<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: 6140245264157490471</body></html>,{Connection=[close], Cache-Control=[no-cache], Content-Type=[text/html; charset=utf-8], Pragma=[no-cache], Content-Length=[188]}>

I tried to call the API with the uri and headers used in my app in Postman and it works :/

I've already search for a similar issue in SOF and Google but can't find any response.

I hope someone will help me :D

Thx

Pierre Jones
  • 620
  • 1
  • 11
  • 24

1 Answers1

0

I found the solution of the issue. It seems to be a bug of the company's firewall which catch this call as a threat ;)

Pierre Jones
  • 620
  • 1
  • 11
  • 24