Nginx angular fallback route

Sami C.
Dec 22, 2020

--

Whenever you navigate to a route that nginx can’t resolve you’ll see a 404 not found. To allow angular to handle the routing simply add the location section, so it redirects back to our index.html

server {
listen 80;
server_name example.org;
root /var/www/example.org/;
location / {
try_files $uri $uri/ /index.html;
}

}

Reload your nginx config:

nginx -s reload

That’s all, Enjoy!

--

--