I have a SPA (Single Page Application) exposed on a S3 server on which I have no control.
It has its (front) routing based on history pushstates in html5 mode. Everything is in an "index.html" page.
Which means that http://example.com:8080/myapp
shows an app with links pointing for example to http://example.com:8080/myapp/about/me
without having a "about" folder : everything is powered by Javascript.
But, if the user refreshes the page http://example.com:8080/myspa/about/me
, he will get a 404.
So I decided to put in place a reverse proxy.
What I tried so far :
server {
listen 8000;
location / {
try_files $uri $uri/ http://example.com:8080/myapp/index.html;
#proxy_pass http://example.com:8080/myapp/;
}
}
With those rules, I can reverse proxy to the app but unfortunately, It doesn't work.
How can a reverse proxy to an app exposing an "index.html" with Javascript routes based on pushstates and allowing the user to refresh the page correctly ?