Nginx location regex is not matching

Solution 1:

I would try it without the brackets around \d, brackets are normally used for either contiguous characters or numbers, your brackets say match either character '\' or 'd'

"^(.*)(\d{10})\.(min\.)?(css|js)$"

Also, are you specifically saving the group info that you're capturing inside the parens?

For clarity on the comments below.

Start simple.

"^.*[0-9]*\.css$"

"^.*[:digit:]*\.css$"

"^.*\d*\.css$"

Depending on which works, use that base for the digits and expand as below.

"^.*\d{10}\.(min\.)?(css|js)$"

If you're matching the http/https as well, you can start it with the http/s stuff below, remember to change to which ever digit notation worked.

"^http(s)?://.*[0-9]{10}\.(min\.)?(css|js)$"