[keycloak-user] keycloak CORS Headers in 401 Response

Joao Costa costajlmpp at gmail.com
Sun Dec 17 17:41:52 EST 2017


I have two keycloack clients,

Angular 4: with Access Type credentials authentication
A JAX RS Application (which will be the resource server): with bearer-only authentication! In this client we activate CORS, as shown by the following json.

> {
>   "realm": "demo-realm",
>   "bearer-only": true,
>   "auth-server-url": "http://demo-keycloack-server:8080/auth <http://demo-keycloack-server:8080/auth>",
>   "ssl-required": "external",
>   "resource": "demo-server",
>   "enable-cors": true
> }

The problem is that the requests to the JAX-RS Application when the response status is Unauthorized 401, this response do not brings the required CORS Headers to javascript client!

How can we add the respective CORS Header when the HTTP Status is 401 ?




More information about the keycloak-user mailing list