I am trying to write a new plugin that dynamically generates upstream url (based on header value).
So far I successfully changed upstream host using:
ngx.ctx.balancer_address
but I need to change path for upstream url too, do you know how can I achieve this ?
I found somewhere that ngx.var.upstream_url but it gives me an error:
“variable “upstream_url” not found for writing;”
As of 0.11.0, and as documented in the
Changelog
and
Upgrade path
of that version, the way to update the upstream URL is via the $upstream_uri NGINX variable, accessible in the Lua-land as ngx.var.upstream_uri.
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
Additionally, you can access the ngx.c…
Thanks for your response, however I had to park this plugin as we do not need it currently. Might come back to it in near future and will try out your solution.
Thanks again.