简体   繁体   中英

How to configure cors on keycloak and nginx?

The problem is this: we have released an application with a Vue front-end and a keycloak authorization server. Keycloak works in a docker containerThe application is located at the URL: app.xxxx.xx, and the authorization is at the URL: auth.xxxx.xx. Nginx is used as a proxy server. Everything starts, but after authorization, the application itself does not load and an error occurs:

Access to XMLHttpRequest at 'https://auth.xxxx.xx/auth/realms/Atlas/protocol/openid-connect/token' (redirected from 'http://auth.xxxx.xx/auth/realms/Atlas/protocol/openid-connect/token') from origin 'http://app.gxxxx.xx.' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Keycloak config

Nginx config

Try using "+" in "Web origins" in your client configuration?

See Web origins .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM