0

Trying to capture URLs like http://mydomain/1234567890123 (13 digits)

        location ~ ^/([\d]{13})$ {
            proxy_pass http://127.0.0.1:4000/product?id=$1;
    }

$1 variable arriving empty, even if URL is being captured. What am I missing?

P.S. Tried also named variables. Not helps.

3
  • Try using a map. Jun 3, 2021 at 9:51
  • @GerardH.Pille why? What is the difference?
    – Tamir
    Jun 3, 2021 at 10:02
  • One of the differences is that maps work. Jun 3, 2021 at 11:39

1 Answer 1

0

An extract from a working configuration using a map:

map $uri $maptest {
    "~^(?<folder1>.*?)/?(\?.*)?$" page-cache$folder1/1.html;
}

server {
        location /node_direct/ {
          proxy_pass http://nodeServers/$maptest;
        }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .