ruby on rails - nginx: remove path from proxy_pass on named location -


i have nginx config serve rails app:

  location ^~ /api/ {     alias /srv/www/rails/public/;     try_files $uri @unicorn;   }    location @unicorn {     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     proxy_set_header x-forwarded-proto $scheme;     proxy_set_header host $http_host;     proxy_redirect off;     proxy_pass http://127.0.0.1:2007;   } 

i want remove /api/ start of path before passing rails app, since it's named location can't add "/" @ end of proxy_pass directive, how can remove /api/ before passing request rails?

use:

location @unicorn {     rewrite ^/api(.*)$ $1 break;     ... } 

see this document details.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -