Condensing Location Directives

I have this setup for my location directives

location /css/ {
  proxy_pass  http://127.0.0.1:8080/css/;
}

location /js/ {
  proxy_pass  http://127.0.0.1:8080/js/;
}

It seems a bit repetitive to me, is it possible to do something like
this.

location /css/, /js/ {
  proxy_pass  http://127.0.0.1:8080/$1;
}

Where you can have one block process multiple locations, then the
variable $1, copies the location defined into the proxy_pass URL? I
might have about 10-20 and it would be easier to have one block then 20.

Posted at Nginx Forum:

It’s possible to use regex, such as:

location ~ ^/(?[^/]+)/ {
proxy_pass http://127.0.0.1:8080/$type/;
}

BUT two static (non-regex) locations are faster.

Andrejs

Posted at Nginx Forum:

I agree with you there on speed which I am not willing to sacrifice,
then maybe ill just submit this as a feature request.

Posted at Nginx Forum: