testing - location and variable condition -


i have problem, in understanding, hase gracefull solution, can not find it:

we have multiple frontend(static) apps:

  • appa
  • appb
  • appc

each app has multiple branches:

  • branchz
  • branchx
  • branchy

feature branch url test served nginx looks folowing

https://appb-branchy.domain.org/index.html

  • all stable apps versions stored on domain.org on local file system /opt/domain/frontend/appn
  • all feature branches stored on remote server https://storage.org/appn/branchz

my current nginx conf host domain.org looks like:

server {     listen 443;      server_name ~^(?<app>(appa|appb|appc)?)-(?<branch>.+?)\.domain\.org$;      # want send storage_upstream requests ^/frontend/$app url     # don't know how.     location ~ ^/frontend/ {         rewrite ^/frontend/(.*)$ /$app/$branch/frontend/$1 break;         proxy_pass https://storage_upstream;     } 

i can't use $app variable in location ~ ^/frontend/ how make requests url ^/frontend/$app send storage_upstream upstream?


Comments