I am trying to get nginx
to work with a pushstate based uri handled by react-router
.
Everything works fine until I try to F5 on a second level uri example.com/MyApp/users
.
My static resources are in example.com/MyApp/resources
.
The problem is that nginx is trying to load my resources in example.com/MyApp/users/resources
whenever I try to access directly (or F5) the users
's view.
Here is my nginx conf :
location ~ ^/MyApp/ {
try_files $uri /MyApp/index.html last;
}
I am new to nginx so I don't really know how everything works...
EDIT :
I changed my conf to this:
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /MyApp/index.html break;
}
}
Now accessing to example.com/MyApp/users
works but example.com/MyApp/users/
doesn't.