Missing CORS Header Problem

Hi!

I have set up a Jax-rs rest api and a react front-end together with a keycloak server.
My React App shall make API-Calls and keycloak is supposed to make sure that the user is authenticated.
The authentication works fine, and the token is assigened to the session, but still if I try to call the api from the react app i get an error in my web console, that the “Access-Control-Allow-Origin” is missing in the Header…

Therefore I started looking for a solution on the internet and until now I set “enable-cors” : true in my keycloak.json file on my rest api-backend. I also wrote a CORS Filter class with the @Provider Annotation.
→ It still doesnt work and nothing seemed to change until here.

I now read in the keycloak documentation that I am supposed to add a CORS header with a certain config file… This can be found in the “Gatekeeper” chapter of the docs. Where do I find this file?
In the Doc it says i shall add the following to the file:
cors-origins:
-"*"
cors-methods:
-GET
-POST

Can someone help me please?
I am very new to this btw, so sorry if I don’t sound very professional here.

Thank you!
Leon

Hello,
Do you find the solution? I’m stuck with the same problem. Please share the solution if you have.