I am trying to serve a react app
with nginx
, and the browser downloads build/index.html
which is accessed by aliases /app/room/main
, /app/room/create
, etc (it is necessary as the app's state depends on URL). How to serve this one file by many aliases without the browser downloading it.
Asked
Active
Viewed 186 times
-1

Kacper Kwaśny
- 92
- 3
- 7
1 Answers
0
Serving react app with nginx.
location /payments/room/ {
# serve static files from build
alias /path/to/build/;
}
location ~ ^/payments/room/(room-create-pick|settings|main|new-payment) {
# these four links should be handled by my react app
# (the index.html) should be returned
alias /path/to/build/;
try_files index.html =404;
}

Kacper Kwaśny
- 92
- 3
- 7