The CGI spec dictates that REQUEST_URI
must be the original unmodified URL from the client.
Really, it’s the app’s responsibility to handle this, because the app has its own routing layer.
That said, it is possible to override, but it’s quite hacky and I don’t recommend it if you can avoid it.
@pdf path_regexp pdf (.*).pdf$
vars @pdf cleaned_path {re.pdf.1}
vars cleaned_path {uri}
php_fastcgi 127.0.0.1:55335 {
env REQUEST_URI {vars.cleaned_path}
}