'How to configure the Nginx for Single Page Application?
I used the React as the frontend and the routes are listed below:
/a
/a/1
/b
And used the Nginx to establish the reverse proxy, but I have to add a prefix route /app. So my new routes will be like:
/app/a
/app/a/1
/app/b
I have tried this, but it didn't work
location ^~/app/ {
rewrite ^/app/(.*)$ /$1 break;
alias /www/;
try_files $uri $uri/ /index.html;
index index.html;
}
How could I configure the Nginx?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|