Working well with Ionic LocationStrategy
provider for app.module.ts
as described here
Build your Ionic sources with ionic build --prod
, and serve the generated www
folder with NGINX.
NGINX default.conf
configuration example :
server {
...
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files /index.html =404;
}
...
NGINX’s try_files
directive will do the job with Ionic PWA routing. Page refresh with F5 will not display 404 anymore