{"action":"created","issue":{"url":"https://api.github.com/repos/Mashape/kong/issues/1532","repository_url":"https://api.github.com/repos/Mashape/kong","labels_url":"https://api.github.com/repos/Mashape/kong/issues/1532/labels{/name}","comments_url":"https://api.github.com/repos/Mashape/kong/issues/1532/comments","events_url":"https://api.github.com/repos/Mashape/kong/issues/1532/events","html_url":"https://github.com/Mashape/kong/issues/1532","id":172685429,"number":1532,"title":"ngx.req.set_uri() ineffective in plugin access method","user":{"login":"sje397","id":214252,"avatar_url":"https://avatars.githubusercontent.com/u/214252?v=3","gravatar_id":"","url":"https://api.github.com/users/sje397","html_url":"https://github.com/sje397","followers_url":"https://api.github.com/users/sje397/followers","following_url":"https://api.github.com/users/sje397/following{/other_user}","gists_url":"https://api.github.com/users/sje397/gists{/gist_id}","starred_url":"https://api.github.com/users/sje397/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sje397/subscriptions","organizations_url":"https://api.github.com/users/sje397/orgs","repos_url":"https://api.github.com/users/sje397/repos","events_url":"https://api.github.com/users/sje397/events{/privacy}","received_events_url":"https://api.github.com/users/sje397/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-23T12:25:21Z","updated_at":"2016-08-25T10:44:58Z","closed_at":null,"body":"### Summary\r\n\r\nI'm trying to transform a request in a plugin, where the request path may be\r\n\r\n> /something/{some id}\r\n\r\nand the upstream url is something like\r\n\r\n> /upsream?id={some id}\r\n\r\nI thought I could accomplish that by calling (inside the plugin access method)\r\n\r\n> ngx.req.set_uri(ngx.ctx.api.request_path)\r\n\r\n...to strip the optional part of the path, but it does not affect the call upstream. With 'strip path' on, it still calls\r\n\r\n> /upsream/{some id}?id={some id}\r\n\r\nAfter all, calling `ngx.req.set_uri_args` does work, and the docs for `set_uri` state it should work in 'access_by_lua' directives.\r\n\r\nIs this a bug? Is there a workaround or something I'm missing?\r\n\r\nThanks!\r\n\r\n### Additional Details & Logs\r\n\r\n- Kong version: 0.9\r\n- OS: Centos 7 (official kong docker)\r\n"},"comment":{"url":"https://api.github.com/repos/Mashape/kong/issues/comments/242346646","html_url":"https://github.com/Mashape/kong/issues/1532#issuecomment-242346646","issue_url":"https://api.github.com/repos/Mashape/kong/issues/1532","id":242346646,"user":{"login":"Andi24","id":9115624,"avatar_url":"https://avatars.githubusercontent.com/u/9115624?v=3","gravatar_id":"","url":"https://api.github.com/users/Andi24","html_url":"https://github.com/Andi24","followers_url":"https://api.github.com/users/Andi24/followers","following_url":"https://api.github.com/users/Andi24/following{/other_user}","gists_url":"https://api.github.com/users/Andi24/gists{/gist_id}","starred_url":"https://api.github.com/users/Andi24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andi24/subscriptions","organizations_url":"https://api.github.com/users/Andi24/orgs","repos_url":"https://api.github.com/users/Andi24/repos","events_url":"https://api.github.com/users/Andi24/events{/privacy}","received_events_url":"https://api.github.com/users/Andi24/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T10:44:57Z","updated_at":"2016-08-25T10:44:57Z","body":"Had the same issue where ngx.req.set_uri had not effect, so that Kong forwarded the request with `upstream_url + initial_request_uri`\r\n\r\n@sje397 thanks for the solution & the vars you mentioned!"}}
{"actor":{"display_login":"Andi24"}}