Unable to perform rewrite


(Damus) #1

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.


(Federico Bruni) #2

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
}

(Crooze) #3

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