{"action":"opened","issue":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1184","labels_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1184/labels{/name}","comments_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1184/comments","events_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1184/events","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/1184","id":68033769,"number":1184,"title":"Login ReturnUrl missing path from PublicOrigin","user":{"login":"mbubnich","id":10741358,"avatar_url":"https://avatars.githubusercontent.com/u/10741358?v=3","gravatar_id":"","url":"https://api.github.com/users/mbubnich","html_url":"https://github.com/mbubnich","followers_url":"https://api.github.com/users/mbubnich/followers","following_url":"https://api.github.com/users/mbubnich/following{/other_user}","gists_url":"https://api.github.com/users/mbubnich/gists{/gist_id}","starred_url":"https://api.github.com/users/mbubnich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbubnich/subscriptions","organizations_url":"https://api.github.com/users/mbubnich/orgs","repos_url":"https://api.github.com/users/mbubnich/repos","events_url":"https://api.github.com/users/mbubnich/events{/privacy}","received_events_url":"https://api.github.com/users/mbubnich/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-13T07:54:48Z","updated_at":"2015-04-13T07:54:48Z","closed_at":null,"body":"When using a reverse proxy with a domain and a path as the PublicOrigin e.g. \"https://proxy/auth\" when authorizing a user who is not logged in (Flow.AuthorizationCode) the user is redirected to the login page and encoding the return url for the authorize endpoint into a cookie this return url when built is missing the path of the PublicOrigin. \r\n\r\nOnce reaching the login request I authenticate the user in the PreAuthenticateAsync method and return. at this point it all breaks as the ReturnUrl is not valid. At the moment as a workaround in the PreAuthenticateAsync method I am pulling the ReturnUrl out of the SingInMessage and restore the path of the public origin.\r\n\r\n            //fix for return uri not having the correct public origin uri embeded.\r\n            if (!message.ReturnUrl.Contains(_environment.Environment.GetIdentityServerBaseUrl()))\r\n            {\r\n                var returnUri = new Uri(message.ReturnUrl);\r\n                var hostUri = new Uri(_environment.Environment.GetIdentityServerHost());\r\n                var finalUri = new Uri(hostUri,hostUri.PathAndQuery.TrimEnd('/') + '/' + returnUri.PathAndQuery.TrimStart('/'));\r\n                message.ReturnUrl = finalUri.AbsoluteUri;\r\n            }\r\n\r\nI think the issue is a result of AuthorizeEndpointController.RedirectToLogin the combination of an existing Uri and a string in a new Uri appears to be ignoring the path in the existing Uri.\r\n\r\n            var path = Url.Route(Constants.RouteNames.Oidc.Authorize, null).AddQueryString(parameters.ToQueryString());\r\n            var host = new Uri(Request.GetOwinEnvironment().GetIdentityServerHost());\r\n            var url = new Uri(host, path);\r\n\r\nIs this a bug or am I configuring something incorrectly?"}}