Unable to perform rewrite

This is what i have for the rewrite section

rewrite /request {
regexp ^/dist/([0-9\d*]).js
to /request/dist/$1.js
}

trying to rewrite from my /request proxy. The way the app was written changed and it is now necessary. it is trying to load mydomain.com/dist instead of mydomain.com/request/dist/

Any help would be appreciated.

I think the basepath is not correct.
The doc says:

basepath is the base path to match before rewriting with regular expression. Default is /.

You are trying to match dist/ and you have already placed it in the regexp.
I would try:

rewrite /dist {
  regexp ^/([0-9\d*]).js
  to /request/dist/$1.js
}
1 Like

fedelibre almost had it. Change the $1 to {1} and it should work.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.