{"action":"closed","issue":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/942","repository_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/942/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/942/comments","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/942/events","html_url":"https://github.com/spring-cloud/spring-cloud-netflix/issues/942","id":145164554,"number":942,"title":"[Question] Spring Oauth2 Authentication AWS behind Zuul","user":{"login":"Writtscher","id":2422250,"avatar_url":"https://avatars.githubusercontent.com/u/2422250?v=3","gravatar_id":"","url":"https://api.github.com/users/Writtscher","html_url":"https://github.com/Writtscher","followers_url":"https://api.github.com/users/Writtscher/followers","following_url":"https://api.github.com/users/Writtscher/following{/other_user}","gists_url":"https://api.github.com/users/Writtscher/gists{/gist_id}","starred_url":"https://api.github.com/users/Writtscher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Writtscher/subscriptions","organizations_url":"https://api.github.com/users/Writtscher/orgs","repos_url":"https://api.github.com/users/Writtscher/repos","events_url":"https://api.github.com/users/Writtscher/events{/privacy}","received_events_url":"https://api.github.com/users/Writtscher/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-04-01T12:12:23Z","updated_at":"2016-10-05T20:55:28Z","closed_at":"2016-10-05T20:55:27Z","body":"Hi,\r\n\r\nI have a question / problem. I've checked everything I could but didn't find a solution. I hope you can help me. My problem is similiar to [this issue](https://github.com/spring-cloud/spring-cloud-netflix/issues/754), I have the same setup: \r\n\r\n```\r\n\r\nhttps://url.net/service\r\n  |-> AWS load balancer\r\n      - adds X-Forwarded-* \r\n      - converts\" https to http\r\n      |-> http://localhost:10000/service\r\n          - Finds correct service for given path\r\n          |-> Service get hit and I see the correct header in the log but the service \r\n              does not redirect me to  the \"X-Forwarded-Host\" but to https://localhost/login\r\n\r\n```\r\n \r\nZuul log: \r\n```\r\nRequest url: /uaa\r\nRequest header: x-forwarded-for XXX.XXX.XXX.XXX (AWS standard)\r\nRequest header: x-forwarded-port 443\r\nRequest header: x-forwarded-proto https\r\n```\r\n\r\nService log:\r\n```\r\nRequest url: /uaa\r\nRequest header: x-forwarded-host XXX.XXX.XXX.XXX (same as  the zuul x-forwarded-for header. I configured server.tomcat.remote-ip-header: X-Forwarded-Host)\r\nRequest header: x-forwarded-port 443\r\nRequest header: x-forwarded-proto: https\r\nRequest header: x-forwarded-prefix: /uaa\r\n```\r\n\r\nEverything looks ok for me. But it does not work as I would expect.. My problem is that the default [LoginUrlAuthenticationEntryPoint](https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPoint.java#L175) does not care about the headers and redirects unauthenticated users to http://localhost/login. This [issue](https://github.com/spring-projects/spring-security/issues/3115) might fix it in the future but does not help me right now :sweat:. The debug log says it **o.s.s.web.DefaultRedirectStrategy: Redirecting to 'https://localhost/login'**. Also there is another log entry that shows that the header are not supported **o.s.s.w.s.HttpSessionRequestCache: DefaultSavedRequest added to session: DefaultSavedRequest[https://localhost/server]**\r\n\r\nI have \r\n```\r\nserver.use-forward-headers: true\r\n```\r\n\r\nactivated for zuul and the service - but it does not help at all. \r\n\r\nAnother strange thing is that the zuul server redirects the user correctly. Not to http:localhost/login but the **X-Forwarded-For** server with **/login** path.\r\n\r\nI have no ideas anymore. Could you please point me in the right direction?\r\n\r\nEdit:\r\nIf I do curl **http://localhost:10100/service/login** on the sercver I see that the location response header is the correct location path,, but spring security does not redirect me to the provided host.. Im totally confused. Somewhere down the line the **X-Forwarded-{For/Host}** header gets lost?\r\n\r\nEdit 2:\r\nIf I config \r\n\r\n```\r\nserver.tomcat.remote-ip-header: X-Forwarded-Host\r\n```\r\n\r\n I don't see the request header logged anymore instead the header **X-Forwarded-For XXX.XXX.XXX** is logged.. If I configure \r\n\r\n```\r\nserver.tomcat.remote-ip-header: X-Forwarded-For\r\n```\r\n\r\n I don't see the request header logged anymore instead the header **X-Forwarded-Host** is logged... Wtf?"}}
{"actor":{"display_login":"spencergibb"}}