I have setup ngnix like this:
# HTML5 pushState nginx configuration
#
# @see: http://stackoverflow.com/a/30515169/1774183
#
# Server block for a client side app with directories:
#
# /
# /foo
# /foo/bar
# /foo/bar/baz
# /foo/bar/baz/123
# /tacos
# /tacos/123
server {
listen 80;
server_name example.com;
root /path/to/my/dist;
gzip_static on;
location / {
try_files $uri $uri/ /index.html;
}
# Attempt to load static files, if not found route to @rootfiles
location ~ (.+)\.(html|json|txt|js|css|jpg|jpeg|gif|png|svg|ico|eot|otf|woff|woff2|ttf)$ {
try_files $uri @rootfiles;
}
# Check for app route "directories" in the request uri and strip "directories"
# from request, loading paths relative to root.
location @rootfiles {
rewrite ^/(foo/bar/baz|foo/bar|foo|tacos)/(.*) /$2 redirect;
}
}
I'm able to load dynamic URLs directly (i.e. pasting the URL example.com/foo/bar/baz/123 in the browser and loading the page) however the contents of /index.html are displayed for about a second and then replaced with an empty page (the layout is still displayed).
Any tips?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c524">#c524</a>)</em></sub></div>