Preset:
We need to substitute a query parameter t=http://endpoint/:df01:/:df02:/:df03:/004.jpg with other query parameters ...?:df01:=1&:df02:=13&:df03:=9 we are passing in the request.
Result:
Redirect the request to http://endpoint/1/13/9/004.jpg.
By now we have a rule in our nginx.conf working well by executing the following rule :
if ($args ~ "^rt=rt0010_01&.*&:df\d+:=(\d+)&:df\d+:=(\d+)&:df\d+:=(\d+)&t=(https?:\/\/.*)\/Newsletter\/.*\/.*\/.*\/(.*)") {
set $location $4;
set $params $2/$1/$3/$5;
rewrite . $location/Newsletter/$params? redirect;
}
Our problem is that we cannot dynamically change the arguments in the t= path like t=http://endpoint/:df01:/:df03:/:df02:/004.jpg, because the params argument is set "hardcoded" to $2/$1/$3/$5.
So my question is, can I build some kind of rewrite rule which parses the :dfxx: params in the t= variable and then substitute it with the other params suppied in the request or do I have to include some module extension which perhaps can do the job? (Btw, we also have to solve the hardcoded /Newsletter in the rewrite , it is yet present in the url supplied by the t=... param).
I was asked to add an example containing a full request and a corresponding response:
REQUEST:
RESPONSE:
http://my.domain/Newsletter/02/609/1/008.jpg
I hope this is sufficient.