CAS and Spring OAuth2 not working behind Nginx Reverse Proxy

33 views
Skip to first unread message

dg

unread,
May 27, 2020, 11:22:56 AM5/27/20
to CAS Community
Hello, i have architecture like below. before going microservice, i have 3 seperate server; spring cloud gateway (8085), spring oauth2 (cas client, 8094), cas server

client
  |
gateway -- oauth2 server -- sso
  |
microservices

here is the request flow;
- 302 http://gateway/login/oauth2/login-client... and take jwt from oauth2 server, and goes microservice with that jwt. 

everything works well, but when i deploy gateway and oauth2 server behind nginx reverse proxy, the service ticket validation not working, and i always need to relogin and relogin and ...at cas server

client
  |
nginx
  |
(gateway -- oauth2 server )-- sso
  |
microservices

here is the request flow;

i am %100 sure that this problem is about nginx. it manipulates something i dont know behind the scene, but i couldnt find.

server {
        listen       80;
        server_name  localhost;
root C:/nginx-1.18.0/sites-enabled;

        location /authz {
    proxy_set_header Host $host;
    proxy_pass http://localhost:8094;
        }

        location /gateway {
            proxy_set_header Host $host;
            proxy_pass http://localhost:8085;
        }

        location /oauth2 {
            proxy_set_header Host $host;
            proxy_pass http://localhost:8085;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }


do you have ideas? thanks


Reply all
Reply to author
Forward
0 new messages