{"action":"opened","number":430,"pull_request":{"url":"https://api.github.com/repos/kubernetes/ingress/pulls/430","id":110462941,"html_url":"https://github.com/kubernetes/ingress/pull/430","diff_url":"https://github.com/kubernetes/ingress/pull/430.diff","patch_url":"https://github.com/kubernetes/ingress/pull/430.patch","issue_url":"https://api.github.com/repos/kubernetes/ingress/issues/430","number":430,"state":"open","locked":false,"title":"Fix add-base-url","user":{"login":"ohmystack","id":2697228,"avatar_url":"https://avatars3.githubusercontent.com/u/2697228?v=3","gravatar_id":"","url":"https://api.github.com/users/ohmystack","html_url":"https://github.com/ohmystack","followers_url":"https://api.github.com/users/ohmystack/followers","following_url":"https://api.github.com/users/ohmystack/following{/other_user}","gists_url":"https://api.github.com/users/ohmystack/gists{/gist_id}","starred_url":"https://api.github.com/users/ohmystack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohmystack/subscriptions","organizations_url":"https://api.github.com/users/ohmystack/orgs","repos_url":"https://api.github.com/users/ohmystack/repos","events_url":"https://api.github.com/users/ohmystack/events{/privacy}","received_events_url":"https://api.github.com/users/ohmystack/received_events","type":"User","site_admin":false},"body":"Fix issue #67 \r\n\r\nHTML \"base\" tag is written for browser.\r\n\r\n### Correct way\r\n\"base\" tag should be: `hostname/location/basename`.\r\nThen, a browser sends the request, something like this`<base>/filename`, to Nginx.\r\nThen, this URI is translated into `service/target/basename/filename` by Nginx.\r\n\r\n### Problem\r\nHowever, in current code, it misses the `basename` part, and confuses the 'location' and 'target'.\r\n\r\n### Solution\r\nWhen the request comes to Nginx, the \"basename\" should be parsed at the entrance, in `buildLocation` method.\r\n\r\n### Bug\r\nThere are 2 bugs in current \"AddBaseURL\":\r\n1. When the rule's `host` field is an empty string, the \"base\" will be generated as `_`, which is wrong. The base-uri hostname should be the one in the HTTP request, `$http_host`.\r\n2. Described in #67. Miss the basename part in base-uri, so that Nginx cannot find the resources. Even the unit-test cases, the `subs_filter` parts, are wrongly designed.\r\n\r\n### Example\r\nFor the most complex case:\r\n\r\nIf we define a redirect rule like this,\r\n\r\n| From  | To  |\r\n|:-:|:-:|\r\n| hostname/FROM  | service/TO  |\r\n\r\nThen, we fetch a web page, `hostname/FROM/dist/index.html`\r\nInside this page's header, the `<base>` tag is generated:\r\n\r\n| ❌ wrong \"base\" tag | ✅ correct \"base\" tag |\r\n|:-:|:-:|\r\n| hostname/TO  | hostname/FROM/dist  |\r\n\r\nAnd, when this web page requests for a JS resource with a link `js/main.js`,\r\n\r\n| ❌ wrong page sends | ✅ correct page should send |\r\n|:-:|:-:|\r\n| hostname/TO/js/main.js  | hostname/FROM/dist/js/main.js |\r\n\r\nOf course, the wrong based request will get a 404.","created_at":"2017-03-13T17:58:36Z","updated_at":"2017-03-13T17:58:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/ingress/pulls/430/commits","review_comments_url":"https://api.github.com/repos/kubernetes/ingress/pulls/430/comments","review_comment_url":"https://api.github.com/repos/kubernetes/ingress/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/ingress/issues/430/comments","statuses_url":"https://api.github.com/repos/kubernetes/ingress/statuses/bbeb9a766cdae4bc97cd3bfd39d0ccd490fe4840","head":{"label":"ohmystack:fix-baseurl","ref":"fix-baseurl","sha":"bbeb9a766cdae4bc97cd3bfd39d0ccd490fe4840","user":{"login":"ohmystack","id":2697228,"avatar_url":"https://avatars3.githubusercontent.com/u/2697228?v=3","gravatar_id":"","url":"https://api.github.com/users/ohmystack","html_url":"https://github.com/ohmystack","followers_url":"https://api.github.com/users/ohmystack/followers","following_url":"https://api.github.com/users/ohmystack/following{/other_user}","gists_url":"https://api.github.com/users/ohmystack/gists{/gist_id}","starred_url":"https://api.github.com/users/ohmystack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohmystack/subscriptions","organizations_url":"https://api.github.com/users/ohmystack/orgs","repos_url":"https://api.github.com/users/ohmystack/repos","events_url":"https://api.github.com/users/ohmystack/events{/privacy}","received_events_url":"https://api.github.com/users/ohmystack/received_events","type":"User","site_admin":false},"repo":{"id":84830777,"name":"ingress","full_name":"ohmystack/ingress","owner":{"login":"ohmystack","id":2697228,"avatar_url":"https://avatars3.githubusercontent.com/u/2697228?v=3","gravatar_id":"","url":"https://api.github.com/users/ohmystack","html_url":"https://github.com/ohmystack","followers_url":"https://api.github.com/users/ohmystack/followers","following_url":"https://api.github.com/users/ohmystack/following{/other_user}","gists_url":"https://api.github.com/users/ohmystack/gists{/gist_id}","starred_url":"https://api.github.com/users/ohmystack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohmystack/subscriptions","organizations_url":"https://api.github.com/users/ohmystack/orgs","repos_url":"https://api.github.com/users/ohmystack/repos","events_url":"https://api.github.com/users/ohmystack/events{/privacy}","received_events_url":"https://api.github.com/users/ohmystack/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ohmystack/ingress","description":"Ingress controllers","fork":true,"url":"https://api.github.com/repos/ohmystack/ingress","forks_url":"https://api.github.com/repos/ohmystack/ingress/forks","keys_url":"https://api.github.com/repos/ohmystack/ingress/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ohmystack/ingress/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ohmystack/ingress/teams","hooks_url":"https://api.github.com/repos/ohmystack/ingress/hooks","issue_events_url":"https://api.github.com/repos/ohmystack/ingress/issues/events{/number}","events_url":"https://api.github.com/repos/ohmystack/ingress/events","assignees_url":"https://api.github.com/repos/ohmystack/ingress/assignees{/user}","branches_url":"https://api.github.com/repos/ohmystack/ingress/branches{/branch}","tags_url":"https://api.github.com/repos/ohmystack/ingress/tags","blobs_url":"https://api.github.com/repos/ohmystack/ingress/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ohmystack/ingress/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ohmystack/ingress/git/refs{/sha}","trees_url":"https://api.github.com/repos/ohmystack/ingress/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ohmystack/ingress/statuses/{sha}","languages_url":"https://api.github.com/repos/ohmystack/ingress/languages","stargazers_url":"https://api.github.com/repos/ohmystack/ingress/stargazers","contributors_url":"https://api.github.com/repos/ohmystack/ingress/contributors","subscribers_url":"https://api.github.com/repos/ohmystack/ingress/subscribers","subscription_url":"https://api.github.com/repos/ohmystack/ingress/subscription","commits_url":"https://api.github.com/repos/ohmystack/ingress/commits{/sha}","git_commits_url":"https://api.github.com/repos/ohmystack/ingress/git/commits{/sha}","comments_url":"https://api.github.com/repos/ohmystack/ingress/comments{/number}","issue_comment_url":"https://api.github.com/repos/ohmystack/ingress/issues/comments{/number}","contents_url":"https://api.github.com/repos/ohmystack/ingress/contents/{+path}","compare_url":"https://api.github.com/repos/ohmystack/ingress/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ohmystack/ingress/merges","archive_url":"https://api.github.com/repos/ohmystack/ingress/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ohmystack/ingress/downloads","issues_url":"https://api.github.com/repos/ohmystack/ingress/issues{/number}","pulls_url":"https://api.github.com/repos/ohmystack/ingress/pulls{/number}","milestones_url":"https://api.github.com/repos/ohmystack/ingress/milestones{/number}","notifications_url":"https://api.github.com/repos/ohmystack/ingress/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ohmystack/ingress/labels{/name}","releases_url":"https://api.github.com/repos/ohmystack/ingress/releases{/id}","deployments_url":"https://api.github.com/repos/ohmystack/ingress/deployments","created_at":"2017-03-13T13:40:06Z","updated_at":"2017-03-13T13:40:08Z","pushed_at":"2017-03-13T17:05:27Z","git_url":"git://github.com/ohmystack/ingress.git","ssh_url":"git@github.com:ohmystack/ingress.git","clone_url":"https://github.com/ohmystack/ingress.git","svn_url":"https://github.com/ohmystack/ingress","homepage":null,"size":20034,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"0cb8f59f70f3f351c0534a101b1b98a803c26ac4","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars1.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":72891330,"name":"ingress","full_name":"kubernetes/ingress","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars1.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/ingress","description":"Ingress controllers","fork":false,"url":"https://api.github.com/repos/kubernetes/ingress","forks_url":"https://api.github.com/repos/kubernetes/ingress/forks","keys_url":"https://api.github.com/repos/kubernetes/ingress/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/ingress/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/ingress/teams","hooks_url":"https://api.github.com/repos/kubernetes/ingress/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/ingress/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/ingress/events","assignees_url":"https://api.github.com/repos/kubernetes/ingress/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/ingress/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/ingress/tags","blobs_url":"https://api.github.com/repos/kubernetes/ingress/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/ingress/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/ingress/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/ingress/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/ingress/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/ingress/languages","stargazers_url":"https://api.github.com/repos/kubernetes/ingress/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/ingress/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/ingress/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/ingress/subscription","commits_url":"https://api.github.com/repos/kubernetes/ingress/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/ingress/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/ingress/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/ingress/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/ingress/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/ingress/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/ingress/merges","archive_url":"https://api.github.com/repos/kubernetes/ingress/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/ingress/downloads","issues_url":"https://api.github.com/repos/kubernetes/ingress/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/ingress/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/ingress/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/ingress/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/ingress/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/ingress/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/ingress/deployments","created_at":"2016-11-04T22:54:14Z","updated_at":"2017-03-13T15:53:14Z","pushed_at":"2017-03-13T15:04:25Z","git_url":"git://github.com/kubernetes/ingress.git","ssh_url":"git@github.com:kubernetes/ingress.git","clone_url":"https://github.com/kubernetes/ingress.git","svn_url":"https://github.com/kubernetes/ingress","homepage":null,"size":20244,"stargazers_count":176,"watchers_count":176,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":98,"forks":111,"open_issues":98,"watchers":176,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/ingress/pulls/430"},"html":{"href":"https://github.com/kubernetes/ingress/pull/430"},"issue":{"href":"https://api.github.com/repos/kubernetes/ingress/issues/430"},"comments":{"href":"https://api.github.com/repos/kubernetes/ingress/issues/430/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/ingress/pulls/430/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/ingress/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/ingress/pulls/430/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/ingress/statuses/bbeb9a766cdae4bc97cd3bfd39d0ccd490fe4840"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":31,"deletions":18,"changed_files":2}}
{"actor":{"display_login":"ohmystack"}}