If the server is on the same computer as the backend server, the problem does not occur,
and I can retrieve data from Keycloak api endpoint by usersResource.get(keycloakId)…
But if Keycloak servwer is on a different network then backend server is a problem and i I receive ststus code 500. Where is a problem?
Internal Server Error messages indicate that something, in general, is wrong. That means something has gone wrong on the website’s server, but the server could not be more specific on what the exact problem is.
As for how to fix your issue, the lack of information your showing us its hard to find what the problem is.
private KeycloakService keycloakService;
UserRepresentation userRepresentation = keycloakService.getUserDetails(keycloakId);
If Keycloak serwer is on a different network each method call on object userRepresentation causes statsu code 500 without any additional informations. On the same natwork, everything is ok.