{"action":"created","issue":{"url":"https://api.github.com/repos/weidazhao/Hosting/issues/19","repository_url":"https://api.github.com/repos/weidazhao/Hosting","labels_url":"https://api.github.com/repos/weidazhao/Hosting/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/weidazhao/Hosting/issues/19/comments","events_url":"https://api.github.com/repos/weidazhao/Hosting/issues/19/events","html_url":"https://github.com/weidazhao/Hosting/issues/19","id":154338318,"number":19,"title":"X-Forwarded-Host header","user":{"login":"rmja","id":2112306,"avatar_url":"https://avatars.githubusercontent.com/u/2112306?v=3","gravatar_id":"","url":"https://api.github.com/users/rmja","html_url":"https://github.com/rmja","followers_url":"https://api.github.com/users/rmja/followers","following_url":"https://api.github.com/users/rmja/following{/other_user}","gists_url":"https://api.github.com/users/rmja/gists{/gist_id}","starred_url":"https://api.github.com/users/rmja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmja/subscriptions","organizations_url":"https://api.github.com/users/rmja/orgs","repos_url":"https://api.github.com/users/rmja/repos","events_url":"https://api.github.com/users/rmja/events{/privacy}","received_events_url":"https://api.github.com/users/rmja/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-05-11T20:42:54Z","updated_at":"2016-05-27T08:00:26Z","closed_at":"2016-05-17T15:53:26Z","body":"In the gateway, would it be possible to set the original Host header as a X-Forwarded-Host header, so that the downstream service has the possibility to read the original Host header?"},"comment":{"url":"https://api.github.com/repos/weidazhao/Hosting/issues/comments/222084820","html_url":"https://github.com/weidazhao/Hosting/issues/19#issuecomment-222084820","issue_url":"https://api.github.com/repos/weidazhao/Hosting/issues/19","id":222084820,"user":{"login":"rmja","id":2112306,"avatar_url":"https://avatars.githubusercontent.com/u/2112306?v=3","gravatar_id":"","url":"https://api.github.com/users/rmja","html_url":"https://github.com/rmja","followers_url":"https://api.github.com/users/rmja/followers","following_url":"https://api.github.com/users/rmja/following{/other_user}","gists_url":"https://api.github.com/users/rmja/gists{/gist_id}","starred_url":"https://api.github.com/users/rmja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmja/subscriptions","organizations_url":"https://api.github.com/users/rmja/orgs","repos_url":"https://api.github.com/users/rmja/repos","events_url":"https://api.github.com/users/rmja/events{/privacy}","received_events_url":"https://api.github.com/users/rmja/received_events","type":"User","site_admin":false},"created_at":"2016-05-27T08:00:26Z","updated_at":"2016-05-27T08:00:26Z","body":"@johnkattenhorn yes it will. I have put up the middleware layer [here](https://github.com/utiliread/UtilireadAspNetCore/tree/master/src/Utiliread.AspNetCore.HttpOverrides).\r\n\r\nNote that for it to work you also need to forward the base path. There is no official http header for that, so I made up `X-Forwarded-BasePath`.\r\n\r\nOn the gateway, you need to make sure that you set the headers right before the gateway is run, on the `subApp`. The reason is that the `Map()` adds the matched path segment to the base path.\r\n\r\nExample on the gateway:\r\n```\r\napp.Map(\"/sms\", subApp =>\r\n                subApp\r\n                    .UseForwardingHeaders(new ForwardingHeadersOptions()\r\n                    {\r\n                        ForwardingHeaders = ForwardingHeaders.XForwardedHost | ForwardingHeaders.XForwardedPathBase\r\n                    })\r\n                    .RunGateway(smsOptions));\r\n```\r\n\r\n\r\nExample on the backend service:\r\n\r\n```\r\n        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)\r\n        {\r\n            app.UseForwardedHeaders(new ForwardedHeadersOptions()\r\n            {\r\n                ForwardedHeaders = ForwardedHeaders.XForwardedHost\r\n            });\r\n            app.UseCustomForwardedHeaders(new CustomForwardedHeadersOptions()\r\n            {\r\n                ForwardedHeaders = CustomForwardedHeaders.XForwardedPathBase\r\n            });\r\n            app.UseMvc();\r\n         }\r\n```"}}
{"actor":{"display_login":"rmja"}}