I have a Nginx proxy configured for a Minio S3 object storage server.
Can I remove some of the query params (more than one agrs) when I'm passing a request to the upstream (Minio) and keep the rest of args?
for example: this is the request that received by Nginx:
/my-private-bucket/my-image.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&w=320&X-Amz-Date=20211218T231908Z&h=200
I need to transform the above link to the below link (i.e. removing the extra args: w=320 and h=200) and then use proxy_pass:
/my-private-bucket/my-image.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20211218T231908Z
Of course I can use multiple IF statements in the location block: Here is a sample or this one. but I think there should be something more rational. Something like using regex and sed in bash:
echo [mentioned uri] | sed -E 's/&?[wh]=[0-9]*//g'
...or even using map blocks in Nginx:
map $args $polished-args
{
default $args
~&?[wh]=[0-9]* ((something magical))
}
Any ideas?