【问题标题】:jhipster keycloak integration always redirect to localhost:8080jhipster keycloak 集成始终重定向到 localhost:8080
【发布时间】:2018-12-11 12:40:34
【问题描述】:

Angular/Spring 使用 jhipster 生成的应用 这是我的应用配置“application.yml

security:
oauth2:
    client:
        access-token-uri: http://test.com:9080/auth/realms/urms/protocol/openid-connect/token
        user-authorization-uri: http://test.com:9080/auth/realms/urms/protocol/openid-connect/auth
        client-id: urms
        client-secret: urms
        client-authentication-scheme: form
        scope: openid profile email
    resource:
        user-info-uri: http://test.com:9080/auth/realms/urms/protocol/openid-connect/userinfo
        token-info-uri: http://example.com:9080/auth/realms/urms/protocol/openid-connect/token/introspect
        prefer-token-info: false

我将应用程序部署到我的域,比如说“test.com”服务器。

问题 一旦用户转到“/login”,他将使用重定向 URL 到达 keycloak,例如

http://test.com:9080/auth/realms/urms/protocol/openid-connect/auth?client_id=urms&redirect_uri=**http://localhost:8080**/login&response_type=code&scope=openid%20profile%20email&state=F2xa8S

知道为什么它固定为localhost:8080吗?

【问题讨论】:

    标签: spring spring-boot jhipster keycloak


    【解决方案1】:

    回答我的问题。问题是我正在运行 nginx 来代理到 spring 服务器。我需要的是我应该调整我的配置以设置以下标题“HOST”所以它将是

    location / {
      proxy_set_header HOST $host;
      proxy_pass http://localhost:8080;
    }
    

    而不是仅仅使用“proxy_pass”

    【讨论】:

    • 感谢您报告修复。
    猜你喜欢
    • 2018-08-07
    • 1970-01-01
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    • 2019-04-18
    • 2021-01-28
    相关资源
    最近更新 更多