{"action":"created","issue":{"url":"https://api.github.com/repos/knative/docs/issues/400","repository_url":"https://api.github.com/repos/knative/docs","labels_url":"https://api.github.com/repos/knative/docs/issues/400/labels{/name}","comments_url":"https://api.github.com/repos/knative/docs/issues/400/comments","events_url":"https://api.github.com/repos/knative/docs/issues/400/events","html_url":"https://github.com/knative/docs/issues/400","id":361611502,"node_id":"MDU6SXNzdWUzNjE2MTE1MDI=","number":400,"title":"Document limitations of redirects in virtual services","user":{"login":"PurpleBooth","id":133327,"node_id":"MDQ6VXNlcjEzMzMyNw==","avatar_url":"https://avatars1.githubusercontent.com/u/133327?v=4","gravatar_id":"","url":"https://api.github.com/users/PurpleBooth","html_url":"https://github.com/PurpleBooth","followers_url":"https://api.github.com/users/PurpleBooth/followers","following_url":"https://api.github.com/users/PurpleBooth/following{/other_user}","gists_url":"https://api.github.com/users/PurpleBooth/gists{/gist_id}","starred_url":"https://api.github.com/users/PurpleBooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PurpleBooth/subscriptions","organizations_url":"https://api.github.com/users/PurpleBooth/orgs","repos_url":"https://api.github.com/users/PurpleBooth/repos","events_url":"https://api.github.com/users/PurpleBooth/events{/privacy}","received_events_url":"https://api.github.com/users/PurpleBooth/received_events","type":"User","site_admin":false},"labels":[{"id":971591926,"node_id":"MDU6TGFiZWw5NzE1OTE5MjY=","url":"https://api.github.com/repos/knative/docs/labels/kind/new-docs-needed","name":"kind/new-docs-needed","color":"a2eeef","default":false},{"id":971591927,"node_id":"MDU6TGFiZWw5NzE1OTE5Mjc=","url":"https://api.github.com/repos/knative/docs/labels/needs%20eng%20input","name":"needs eng input","color":"c5e87f","default":false},{"id":1024540577,"node_id":"MDU6TGFiZWwxMDI0NTQwNTc3","url":"https://api.github.com/repos/knative/docs/labels/priority/2","name":"priority/2","color":"c4dafc","default":false}],"state":"open","locked":false,"assignee":{"login":"mdemirhan","id":4033879,"node_id":"MDQ6VXNlcjQwMzM4Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/4033879?v=4","gravatar_id":"","url":"https://api.github.com/users/mdemirhan","html_url":"https://github.com/mdemirhan","followers_url":"https://api.github.com/users/mdemirhan/followers","following_url":"https://api.github.com/users/mdemirhan/following{/other_user}","gists_url":"https://api.github.com/users/mdemirhan/gists{/gist_id}","starred_url":"https://api.github.com/users/mdemirhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdemirhan/subscriptions","organizations_url":"https://api.github.com/users/mdemirhan/orgs","repos_url":"https://api.github.com/users/mdemirhan/repos","events_url":"https://api.github.com/users/mdemirhan/events{/privacy}","received_events_url":"https://api.github.com/users/mdemirhan/received_events","type":"User","site_admin":false},"assignees":[{"login":"mdemirhan","id":4033879,"node_id":"MDQ6VXNlcjQwMzM4Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/4033879?v=4","gravatar_id":"","url":"https://api.github.com/users/mdemirhan","html_url":"https://github.com/mdemirhan","followers_url":"https://api.github.com/users/mdemirhan/followers","following_url":"https://api.github.com/users/mdemirhan/following{/other_user}","gists_url":"https://api.github.com/users/mdemirhan/gists{/gist_id}","starred_url":"https://api.github.com/users/mdemirhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdemirhan/subscriptions","organizations_url":"https://api.github.com/users/mdemirhan/orgs","repos_url":"https://api.github.com/users/mdemirhan/repos","events_url":"https://api.github.com/users/mdemirhan/events{/privacy}","received_events_url":"https://api.github.com/users/mdemirhan/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-09-19T07:19:33Z","updated_at":"2018-09-26T08:09:41Z","closed_at":null,"author_association":"NONE","body":"## Expected Behavior\r\n\r\nWhen you issue a 30X redirect is issued by a service behind an entry route, you might expect the response to be rewritten like below (I know I did, perhaps naively).\r\n\r\nAssuming a setup like the [knative-routing-go](https://github.com/knative/docs/blob/master/serving/samples/knative-routing-go) example.\r\n\r\n```\r\nRequest: http://example.com/login/resource -> login-service.default.example.com/resource\r\nResponse: 302 login-service.default.example.com/other-resource ->  http://example.com/login/other-page\r\n```\r\n\r\nThis is less of a problem with Istio alone because you can change the VirtualServer that points to your service directly, and make it work with the host you want, however with Knative you need to route back to `knative-ingressgateway.istio-system.svc.cluster.local`, meaning you have to rewrite `Host: example.com` to `Host: login-service.default.example.com`.\r\n\r\nThere should be a note about this.\r\n\r\n## Actual Behavior\r\n\r\n```\r\nRequest: http://example.com/login/resource -> login-service.default.example.com/resource\r\nResponse: 302 login-service.default.example.com/other-resource ->  http://login-service.default.example.com/other-page\r\n```\r\n\r\nAnd no note about the leaked generic domain.\r\n\r\n## Additional Info\r\n\r\n**Note:** I don't expect a solution to this problem, just giving context to the above.\r\n\r\nMy specific problem here is I want a custom domain on a per-service basis, like purplebooth.co.uk and www.purplebooth.co.uk, then to route that internally to the right service.\r\n\r\n```yaml\r\napiVersion: networking.istio.io/v1alpha3\r\nkind: VirtualService\r\nmetadata:\r\n  name: purplebooth-co-uk-v2-domain\r\n  labels:\r\n    app: purplebooth-co-uk-v2\r\nspec:\r\n  gateways:\r\n  - knative-shared-gateway.knative-serving.svc.cluster.local\r\n  hosts:\r\n  - purplebooth.co.uk\r\n  - www.purplebooth.co.uk\r\n  http:\r\n  - rewrite:\r\n      authority:  purplebooth-co-uk-v2.default.solace-system.net\r\n    route:\r\n      - destination:\r\n          host: knative-ingressgateway.istio-system.svc.cluster.local\r\n        weight: 100\r\n```\r\n\r\nLike in the [knative-routing-go](https://github.com/knative/docs/blob/master/serving/samples/knative-routing-go) example, all be it simpler. I assume this will be a pretty common problem.\r\n\r\nI am not worried about rewriting URLs in the page or anything, just handling a specific case with a redirect. I tried something similar to below, however, it has that specific version in the headers, and didn't seem to trigger the scaling up/down process.\r\n\r\n```yaml\r\napiVersion: networking.istio.io/v1alpha3\r\nkind: VirtualService\r\nmetadata:\r\n  labels:\r\n    route: purplebooth-co-uk-v2\r\n  name: purplebooth-co-uk-v2\r\n  namespace: default\r\nspec:\r\n  gateways:\r\n  - knative-shared-gateway.knative-serving.svc.cluster.local\r\n  - mesh\r\n  hosts:\r\n  - 'purplebooth.co.uk'\r\n  http:\r\n  - appendHeaders:\r\n      knative-serving-namespace: default\r\n      knative-serving-revision: purplebooth-co-uk-v2-00001\r\n      x-envoy-upstream-rq-timeout-ms: \"0\"\r\n    match:\r\n    - authority:\r\n        exact: purplebooth-co-uk-v2.default.solace-system.net\r\n    - authority:\r\n        exact: purplebooth-co-uk-v2.default.svc.cluster.local\r\n    route:\r\n    - destination:\r\n        host: activator-service.knative-serving.svc.cluster.local\r\n        port:\r\n          number: 80\r\n      weight: 100\r\n    timeout: 60s\r\n```\r\n\r\nNow I can force the redirect to go to the correct URL by manually setting it to a specific URL, but that doesn't feel like a very nice solution, particularly if in the future I want to compose existing customers APIs together."},"comment":{"url":"https://api.github.com/repos/knative/docs/issues/comments/424625302","html_url":"https://github.com/knative/docs/issues/400#issuecomment-424625302","issue_url":"https://api.github.com/repos/knative/docs/issues/400","id":424625302,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDYyNTMwMg==","user":{"login":"PurpleBooth","id":133327,"node_id":"MDQ6VXNlcjEzMzMyNw==","avatar_url":"https://avatars1.githubusercontent.com/u/133327?v=4","gravatar_id":"","url":"https://api.github.com/users/PurpleBooth","html_url":"https://github.com/PurpleBooth","followers_url":"https://api.github.com/users/PurpleBooth/followers","following_url":"https://api.github.com/users/PurpleBooth/following{/other_user}","gists_url":"https://api.github.com/users/PurpleBooth/gists{/gist_id}","starred_url":"https://api.github.com/users/PurpleBooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PurpleBooth/subscriptions","organizations_url":"https://api.github.com/users/PurpleBooth/orgs","repos_url":"https://api.github.com/users/PurpleBooth/repos","events_url":"https://api.github.com/users/PurpleBooth/events{/privacy}","received_events_url":"https://api.github.com/users/PurpleBooth/received_events","type":"User","site_admin":false},"created_at":"2018-09-26T08:09:41Z","updated_at":"2018-09-26T08:09:41Z","author_association":"NONE","body":"I didn't get it first reading, but second reading it made sense to me 👍 "}}
{"actor":{"display_login":"PurpleBooth"}}