You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a plugin for Kong to do URL Rewriting and noticed that testing against 0.10.3 is behaving as expected, but when using code from master it does not work properly.
Using ngx.req.set_uri on 0.10.3 results in the URL being changed before the request is made upstream. On master, using ngx.req.set_uri results in no change made to the request before being proxied upstream.
This example has a test that sets up an api, test1.com -> mockbin.com (same as the example plugin) and registers the plugin. The test then makes a request to /request/foo. The plugin simply runs ngx.req.set_uri("/request/bar"). In 0.10.3, the response shows that I get mockbin.com/request/bar, but when running the test on master, it says the request was to mockbin.com/request/foo.
The upstream URI is now determined via the Nginx $upstream_uri variable. Custom plugins using the ngx.req.set_uri() API will not be taken into consideration anymore. One must now set the ngx.var.upstream_uri variable from the Lua land. #2519
We'll make sure that the upcoming 0.10.4 release does not include this change.
Summary
I wrote a plugin for Kong to do URL Rewriting and noticed that testing against 0.10.3 is behaving as expected, but when using code from master it does not work properly.
Using ngx.req.set_uri on 0.10.3 results in the URL being changed before the request is made upstream. On master, using ngx.req.set_uri results in no change made to the request before being proxied upstream.
I made a simplified plugin as an example to show the problem:
https://github.com/nguse/kong-plugin-test
This example has a test that sets up an api, test1.com -> mockbin.com (same as the example plugin) and registers the plugin. The test then makes a request to /request/foo. The plugin simply runs ngx.req.set_uri("/request/bar"). In 0.10.3, the response shows that I get mockbin.com/request/bar, but when running the test on master, it says the request was to mockbin.com/request/foo.
Steps To Reproduce
The text was updated successfully, but these errors were encountered: