Skip to content

Branch fix 404 nginx#143

Merged
zachchong merged 4 commits intomasterfrom
branch-fix-404-nginx
Dec 1, 2025
Merged

Branch fix 404 nginx#143
zachchong merged 4 commits intomasterfrom
branch-fix-404-nginx

Conversation

@zachchong
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to fix nginx 404 handling for a Single Page Application (SPA) by reorganizing the proxy_intercept_errors directive and modifying the error_page configuration.

Key Changes:

  • Moved proxy_intercept_errors on; from global scope into the location / block to scope error interception to frontend routes only
  • Changed error_page 404 = /index.html; to error_page 404 /index.html; (removed the = operator)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app-reverse-proxy/nginx-base.conf Outdated
proxy_intercept_errors on;
# when the proxied frontend responds 404, rewrite internally to /index.html
error_page 404 = /index.html;
error_page 404 /index.html;
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the = sign from the error_page directive changes the behavior in a potentially problematic way.

With error_page 404 = /index.html;, nginx returns a 200 OK status with the index.html content, which is correct for valid client-side routes.

With error_page 404 /index.html;, nginx returns a 404 status code while serving the index.html content, which is incorrect for legitimate SPA routes (e.g., /about, /profile). Browsers and search engines will see these as failed requests.

Consider reverting to error_page 404 = /index.html; to properly handle client-side routes.

Suggested change
error_page 404 /index.html;
error_page 404 = /index.html;

Copilot uses AI. Check for mistakes.
@zachchong zachchong merged commit 74d4c2d into master Dec 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants