Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostname different to localhost #2

Closed
rmcruzv opened this issue May 27, 2016 · 4 comments
Closed

hostname different to localhost #2

rmcruzv opened this issue May 27, 2016 · 4 comments

Comments

@rmcruzv
Copy link

rmcruzv commented May 27, 2016

Hi friend,

I have been using your solution and I would like to say that works perfect while it's tested over localhost. But if I move the uaa-server and the gateway-server to a different host, the /uaa/oauth/authorize changes the "location" header to "uaa-host:gateway-port/uaa/login"

Ej:
eureka-server: 192.168.0.10:8761
gateway-server: 192.168.0.11:8080
uaa-server: 192.168.0.12:9999

When gateway redirects to 192.168.0.11:8080/uaa/oauth/authorize, the "location" header of this response is change to: 192.168.0.12:8080/login

Could you tell me what I'm doing wrong?

@kakawait
Copy link
Owner

kakawait commented May 27, 2016

Hi @rmcruzv

To be honest I never tried outside localhost scope! So it may have a bug.

Could you please share with me your configuration files (properties or yml)?

I will check that after the weekend.


And if possible a HAR file or something that I can use to analyze request/response flow

@rmcruzv
Copy link
Author

rmcruzv commented May 27, 2016

Finally I found a solution thanks to khuser.
Basically that he does is create a ZuulFilter that overrides de "location" header changing the uaa-host by the proxy host

You can view the solution at:

spring-guides/tut-spring-security-and-angular-js#43 (comment)

My zuul config (I'm using SSL):

security:
  oauth2:
    client:
      accessTokenUri: https://localhost:${server.port}/sso/oauth/token
      userAuthorizationUri: /sso/oauth/authorize
...
eureka:
  client:
    serviceUrl:
      defaultZone: http://192.168.0.9:8761/eureka/
  instance:
    preferIpAddress: false
    hostname: 192.168.0.12
    securePortEnabled: true
    securePort: ${server.port}

My uaa-config

eureka:
  client:
    serviceUrl:
      defaultZone: http://192.168.0.9:8761/eureka/
  instance:
    preferIpAddress: true
    hostname: 192.168.0.10

Thanks for the quick answer

@kakawait
Copy link
Owner

Ok thank you for feedback, I think your solution is quite same as the following workaround: spring-cloud/spring-cloud-netflix#942 (comment)

I think I will try to create a docker setup with multi-domain (plus upgrade to Brixton.RELEASE) to improve POC

@kakawait
Copy link
Owner

@rmcruzv I'm using this implementation (a bit reworked for my special needs) on docker env, so each services have diff IP and I didn't reproduce any special issue.

Do you tried with latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants