Thanks Jeremy, we we hoping to use an existing/stable plugin to do this (lua appears to be "experimental" and we don't use it anywhere at the moment). It seems like header_rewrite is 99% of the way there so if it means adding this one feature we'd prefer that since it wouldn't involve new config syntax and/or plugins. 


On Wednesday, October 7, 2015 1:41 PM, Jeremy Payne <> wrote:

Not sure if you are just researching or what.. But this same functionality is also supported in the lua plugin.


On Wed, Oct 7, 2015 at 12:41 PM, Scott Beardsley <> wrote:
I'd like to modify the destination port based on an incoming request header. It seems like everything I need is available in the header_rewrite plugin except the value expansion in the "set-destination port" directive. In the docs it says that this expansion only works for add-header[1]. 

Is there a way to do something like the following via the existing plugin, maybe my syntax is wrong? 

cond %{CLIENT-HEADER:NEW-PORT} /^[1-9][0-9]*$/
set-destination PORT %{CLIENT-HEADER:NEW-PORT} [L]

When I test it I get this debug message: "Would set destination PORT to an invalid range, skipping"

Which points me at this code[2]. It looks like the _value variable is set to the string "%{CLIENT-HEADER:NEW-PORT}" so I guess there is no expansion...

Assuming header_rewrite doesn't support this yet, are there any objections to adding this feature?