Plugin Development: Is it possible to get the stripped uri in the plugin?


ngx.var.request_uri gives me the entire uri, but I’d like to get the stripped uri.

For example I add an api as follows:

  • /myfirstapi or /myfirstapi/v1 or /myfirstapi/v1/beta
  • and say I access /myfirstapi/hello/world or /myfirstapi/v1/hello/world or /myfirstapi/v1/beta/hello/world
  • I’d like to get hold of /hello/world in the plugin

Is there anything in the context that would give me this value?



While not official, the list of values from the router that you can currently access from your plugin is described In this message.

No other values are exposed except those that you can retrieve from ngx_lua and NGINX itself.


That worked! Thanks @thibaultcha. Happy Holidays!