Prowlarr RSS search and Nginx reverse proxy (regex location)

I’m trying to setup nginx reverse proxy with rss search (prowlarr#182)

https://host.domain/prowlarr/{searchID}/api?t=search&q={query}&apikey={apiKey}

However using regex on location doesn’t seem to work, always get 403 error on /api (outside my lan)

location ^~ /prowlarr {
    include /config/nginx/proxy.conf;
    include /config/nginx/resolver.conf;
    set $upstream_app prowlarr;
    set $upstream_port 9696;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    allow 10.0.0.0/24;
    allow 127.0.0.1;
    deny all;
}

location ^~ /prowlarr(/[0-9]+)/api {
    include /config/nginx/proxy.conf;
    include /config/nginx/resolver.conf;
    set $upstream_app prowlarr;
    set $upstream_port 9696;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}

Not using regex to works: location ^~ /prowlarr/1/api
/api seems to work even with auth_request on Radarr/Sonarr, just RSS Search don’t.

I already tried with:

location ~* /prowlarr(/[0-9]+)/api
location ~* "/prowlarr(/[0-9]+)/api?.+$"

Nothing seems to work.
Tested with https://nginx.viraptor.info/ and always match.

nginx error.log

2021/08/26 21:01:04 [error] 982#982: *1591 access forbidden by rule, client: 185.220.100.251, server: _, request: "GET /prowlarr/1/api?t=search&q=windows&apikey=<API_KEY> HTTP/2.0", host: "host.domain"

nginx access.log

185.220.100.251 - - [26/Aug/2021:21:01:04 +0100] "GET /prowlarr/1/api?t=search&q=windows&apikey=<API_KEY> HTTP/2.0" 403 107 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"

Example with Nginx Regex Tester

Workaround: With subdomain regex works without issue.
Using sample config (prowlarr.subdomain.conf.sample)

Changes:


location / {
        ...
        allow 10.0.0.0/24;
        allow 127.0.0.1;
        deny all;
}

# Requires /download to be able to download
location ~ (/prowlarr)?(/[0-9]+)?/(api|download) {
        ...
}