{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3174","repository_url":"https://api.github.com/repos/kubernetes/ingress-nginx","labels_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3174/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3174/comments","events_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3174/events","html_url":"https://github.com/kubernetes/ingress-nginx/pull/3174","id":366437130,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMTExMTgy","number":3174,"title":"Generalize Rewrite Block Creation and Deprecate AddBaseUrl (not backwards compatible) ","user":{"login":"zrdaley","id":17059671,"node_id":"MDQ6VXNlcjE3MDU5Njcx","avatar_url":"https://avatars2.githubusercontent.com/u/17059671?v=4","gravatar_id":"","url":"https://api.github.com/users/zrdaley","html_url":"https://github.com/zrdaley","followers_url":"https://api.github.com/users/zrdaley/followers","following_url":"https://api.github.com/users/zrdaley/following{/other_user}","gists_url":"https://api.github.com/users/zrdaley/gists{/gist_id}","starred_url":"https://api.github.com/users/zrdaley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zrdaley/subscriptions","organizations_url":"https://api.github.com/users/zrdaley/orgs","repos_url":"https://api.github.com/users/zrdaley/repos","events_url":"https://api.github.com/users/zrdaley/events{/privacy}","received_events_url":"https://api.github.com/users/zrdaley/received_events","type":"User","site_admin":false},"labels":[{"id":764356976,"node_id":"MDU6TGFiZWw3NjQzNTY5NzY=","url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":486873161,"node_id":"MDU6TGFiZWw0ODY4NzMxNjE=","url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":764353547,"node_id":"MDU6TGFiZWw3NjQzNTM1NDc=","url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/do-not-merge/hold","name":"do-not-merge/hold","color":"e11d21","default":false},{"id":676097629,"node_id":"MDU6TGFiZWw2NzYwOTc2Mjk=","url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/size/L","name":"size/L","color":"ee9900","default":false}],"state":"open","locked":false,"assignee":{"login":"ElvinEfendi","id":1150042,"node_id":"MDQ6VXNlcjExNTAwNDI=","avatar_url":"https://avatars0.githubusercontent.com/u/1150042?v=4","gravatar_id":"","url":"https://api.github.com/users/ElvinEfendi","html_url":"https://github.com/ElvinEfendi","followers_url":"https://api.github.com/users/ElvinEfendi/followers","following_url":"https://api.github.com/users/ElvinEfendi/following{/other_user}","gists_url":"https://api.github.com/users/ElvinEfendi/gists{/gist_id}","starred_url":"https://api.github.com/users/ElvinEfendi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElvinEfendi/subscriptions","organizations_url":"https://api.github.com/users/ElvinEfendi/orgs","repos_url":"https://api.github.com/users/ElvinEfendi/repos","events_url":"https://api.github.com/users/ElvinEfendi/events{/privacy}","received_events_url":"https://api.github.com/users/ElvinEfendi/received_events","type":"User","site_admin":false},"assignees":[{"login":"aledbf","id":161571,"node_id":"MDQ6VXNlcjE2MTU3MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/161571?v=4","gravatar_id":"","url":"https://api.github.com/users/aledbf","html_url":"https://github.com/aledbf","followers_url":"https://api.github.com/users/aledbf/followers","following_url":"https://api.github.com/users/aledbf/following{/other_user}","gists_url":"https://api.github.com/users/aledbf/gists{/gist_id}","starred_url":"https://api.github.com/users/aledbf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aledbf/subscriptions","organizations_url":"https://api.github.com/users/aledbf/orgs","repos_url":"https://api.github.com/users/aledbf/repos","events_url":"https://api.github.com/users/aledbf/events{/privacy}","received_events_url":"https://api.github.com/users/aledbf/received_events","type":"User","site_admin":false},{"login":"ElvinEfendi","id":1150042,"node_id":"MDQ6VXNlcjExNTAwNDI=","avatar_url":"https://avatars0.githubusercontent.com/u/1150042?v=4","gravatar_id":"","url":"https://api.github.com/users/ElvinEfendi","html_url":"https://github.com/ElvinEfendi","followers_url":"https://api.github.com/users/ElvinEfendi/followers","following_url":"https://api.github.com/users/ElvinEfendi/following{/other_user}","gists_url":"https://api.github.com/users/ElvinEfendi/gists{/gist_id}","starred_url":"https://api.github.com/users/ElvinEfendi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElvinEfendi/subscriptions","organizations_url":"https://api.github.com/users/ElvinEfendi/orgs","repos_url":"https://api.github.com/users/ElvinEfendi/repos","events_url":"https://api.github.com/users/ElvinEfendi/events{/privacy}","received_events_url":"https://api.github.com/users/ElvinEfendi/received_events","type":"User","site_admin":false}],"milestone":null,"comments":12,"created_at":"2018-10-03T17:02:39Z","updated_at":"2018-10-26T13:43:46Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3174","html_url":"https://github.com/kubernetes/ingress-nginx/pull/3174","diff_url":"https://github.com/kubernetes/ingress-nginx/pull/3174.diff","patch_url":"https://github.com/kubernetes/ingress-nginx/pull/3174.patch"},"body":"<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide/pull-requests.md#the-pull-request-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide\r\n2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\n\r\nWhen the `rewrite-target` annotation is used and the written path uses regex and does not end in `/` (ex. `foo/bar/.+`), rewrite does not work as expected. This provides a regex check in `BuildProxyPass` and uses a custom rewrite block if the `use-regex` annotation is true for a location.\r\n\r\n_UPDATE_\r\nIn addition to the above, this PR deprecates the `AddBaseUrl` annotation. \r\n\r\n**Problem**\r\n\r\nAn ingress is created with `use-regex=\"true\"` and `rewrite-target=\"/new\"` and the path `/foo/bar/.+`.\r\n\r\nThis results in the following rewrite blocks for that location:\r\n```\r\nrewrite (?i)/foo/bar/.+/(.*) /new/$1 break;\r\nrewrite (?i)/foo/bar/.+$ /new break;\r\n...\r\n```\r\n\r\nTherefore a request to `/foo/bar/bar` will go to `/new` instead of `/new/bar` as a user may expect.\r\n\r\n**Solution**\r\n\r\nCheck if a use-regex is true for a location when building the proxy pass. \r\n\r\nAn ingress is created with `use-regex=\"true\"` and `rewrite-target=\"/new/$1\"` and the path `/foo/bar/(.+)`.\r\n\r\nThis results in the following rewrite blocks for that location:\r\n```\r\nrewrite (?i)/foo/bar/(.+) /new/$1 break;\r\n...\r\n```\r\n\r\nNow a request to `/foo/bar/bar` will go to `/new/bar`.\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/comments/433412196","html_url":"https://github.com/kubernetes/ingress-nginx/pull/3174#issuecomment-433412196","issue_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3174","id":433412196,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzQxMjE5Ng==","user":{"login":"zrdaley","id":17059671,"node_id":"MDQ6VXNlcjE3MDU5Njcx","avatar_url":"https://avatars2.githubusercontent.com/u/17059671?v=4","gravatar_id":"","url":"https://api.github.com/users/zrdaley","html_url":"https://github.com/zrdaley","followers_url":"https://api.github.com/users/zrdaley/followers","following_url":"https://api.github.com/users/zrdaley/following{/other_user}","gists_url":"https://api.github.com/users/zrdaley/gists{/gist_id}","starred_url":"https://api.github.com/users/zrdaley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zrdaley/subscriptions","organizations_url":"https://api.github.com/users/zrdaley/orgs","repos_url":"https://api.github.com/users/zrdaley/repos","events_url":"https://api.github.com/users/zrdaley/events{/privacy}","received_events_url":"https://api.github.com/users/zrdaley/received_events","type":"User","site_admin":false},"created_at":"2018-10-26T13:43:46Z","updated_at":"2018-10-26T13:43:46Z","author_association":"CONTRIBUTOR","body":"The example at https://github.com/kubernetes/ingress-nginx/pull/3174/files#diff-d7b5d6b068bddc5bf3f13a35093ef069R25 will still work the same as before because the root case for `rewrite-target` never appended `baseuri`. \r\n\r\n@ElvinEfendi That all sounds good, I'll make the changes above and squash the commits. Then we can hold this PR until then. \r\n\r\n\r\n"}}
{"actor":{"display_login":"zrdaley"}}