Route and redirect chain checker

nginx -t passing ≠ website accessible. Our own backend address /admin Long-term bad: 301 redirects to /admin/, and that’s a real directory with no index file—browsers show a blank 403 page. Syntax checks pass completely, yet logs are flooded with "directory index is forbidden". This tool gives you a curl health-check script that prints status codes hop-by-hop, plus nginx fix snippets for corresponding failures.

Free · No login required Local generation · Content is not uploaded Corresponding incident · Admin URL 301→403 white screen

1Site and path

Recommend writing in pairs: /x and /x/ Test both; their behaviors often differ.

2nginx fix options

ResultHealth check overview

Outputcurl redirect chain health check script

0 lines
—
Either run on the server or locally:bash route-check.sh. The status code and Location header for each hop are printed.

Outputnginx fix snippet

0 lines
—

Quick ReferenceWhen you see this status, check these places first

PhenomenonMost common root causeHow to verify
301 → with trailing slash → 403The path name is a real directorytry_files $uri $uri/ Triggers directory redirection, but the directory contains no index file.ls /var/www/site/this-directory Check whether index.html exists
Too many redirectsMutual nesting of exact-match location 301 redirects and try_files internal redirectsCheck in the script whether the Location header redirects back to the previous URL.
Clean URL returns 404, but .html version works normally.Avoid redundant try_files $uri.htmlAdd try_files $uri $uri.html $uri/ =404;
.html is 301-redirected to an incorrect clean URL.Used in location if Perform regex validation, coverage achieved $1 Capture GroupMove the if condition out of this location block, or use map instead
A certain prefix path does not match the expected location.Regex location takes precedence over ^~ Hit before prefix (^~ Overrides regex, but ordinary prefix locations won’t)nginx -T | grep -n location Check order and type
403 and the log says "forbidden by rule".deny rules or file permissionsCheck the specific line in the error log—don’t guess.
We've fallen into this pitfall

1 · Admin URL consistently returns 403./admin Redirected to 301 /admin/, while /admin/ It is a real directory (containing data/), with no index file → 403 white screen. Only /admin.html Accessible.

2. Rewriting is internal rewriting, not adding an index.rewrite ^/admin/?$ /admin.html last; Ensure both /admin and /admin/ resolve directly to the file, with login protection unchanged.

3 · Syntax checks cannot detect this type of issue.nginx -t Syntax-only check: it flags zero errors for redirect chains, directory indexing, and other logic issues. After changes, always verify with real HTTP requests—check status codes and redirect counts.

4 · Paired testing/x and /x/ These are two distinct URIs; matching rules may differ, and both must return 200.