I have a node application that accepts all routes starting at /
. The Nginx / Passenger configuration for it is:
server {
listen 8889;
server_name localhost;
location / {
root /var/www/portal/public;
passenger_enabled on;
passenger_min_instances 1;
passenger_app_env production;
}
location ~ /error/(.+) {
alias /var/www/error-pages/$1;
}
}
I want to move the application to run at /portal
without changing anything about the node application. I've tried something like this without much luck:
server {
listen 8889;
server_name localhost;
root /var/www/portal/public;
location / {
return 301 /client;
}
location /portal {
passenger_base_uri /;
passenger_app_root /var/www/portal;
passenger_document_root /var/www/portal/public;
passenger_min_instances 1;
passenger_app_env production;
passenger_enabled on;
}
location ~ /error/(.+) {
alias /var/www/error-pages/$1;
}
}
The problem is that the application continues to receive requests prefixed with /portal
instead of /
. I tried adding rewrite
statements, but they do not seem to affect what Passenger passes into the application.