Requests return 500 fast; error log shows "rewrite or internal redirection cycle".
A location or rewrite sends the request back into itself.
grep "redirection cycle" /var/log/nginx/error.loglocation / { try_files $uri $uri/ /index.html; } # if /index.html matches this location again, looplocation = /index.html { root /app/dist; }One fallthrough rule per server; test with curl -H and error log open.
Full walkthrough: NGINX 500 "Internal Redirect Cycle": Break the Loop on the NinjaOps blog.
Spinning up a fresh box to reproduce or escape this error?
Managed cloud hostingNinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.
Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog