I'm trying to split a URI in nginx in order to break it down into components. I'll explain why as we go along. Take this url:
http://example.com/resize/customer-id/image.jpg/100/100/
What I need to do now is split that URI into components so I can manipulate it.
for example I what to send a proxy_pass to:
http://backend/customer-id/image.jpg
This is dropping the resize part of the location match and the two end components.
The values at the end I'm actually wishing to use with:
image_filter resize $3 $4
If anyone knows the answer can you help please i'm going round in circles at the moment!
Cheers Ric
Not tested, as an example.
Next you can use variables in location.
if ($uri ~ ^/resize(/customer-id/image.jpg)/([0-9]+)/([0-9]+)/$ {
set $path1 $1;
set $w $2;
set $h $3;
}