One of the solutions is to upgrade the adapter to 8.0.0. This problem seems to be fixed in version 8.0.0.
It was known problem KEYCLOAK-6073:
Add support for OpenID Connect Discovery to Java adapters...
Adapters should support using different URLs for frontend and backend requests.