Basemm
Basemm

Reputation: 1254

jhipster keycloak integration always redirect to localhost:8080

Angular/Spring app generated using jhipster here's my app configs "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

I deployed the application to my domain let's say "test.com" server.

Problem Once user go to "/login" he will reach keycloak with redirection URL like

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

Any idea why it's fixed to localhost:8080?

Upvotes: 0

Views: 1389

Answers (1)

Basemm
Basemm

Reputation: 1254

Answering my question. The issue was that I am running nginx to proxy to spring server. What I needed is that I should adjust my configuration to set the following header "HOST" so it will be

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

Instead of simply using "proxy_pass" only

Upvotes: 2

Related Questions