[GH-ISSUE #1593] Intercept errors with error page not working #1199

Closed
opened 2026-02-26 06:36:11 +03:00 by kerem · 11 comments
Owner

Originally created by @Rod-O on GitHub (Nov 18, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1593

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • No
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug
I have this code on Advanced tab-> Custom Nginx Configuration that accounts for SPA routes

proxy_intercept_errors on;
error_page 404 = /index.html;

This was working on 2.9.9, upgraded to latest and now I have 404

Nginx Proxy Manager Version
2.9.12

To Reproduce
Steps to reproduce the behavior:

  1. use SPA routes with this code

Expected behavior
Simple page reload

Originally created by @Rod-O on GitHub (Nov 18, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1593 **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - No - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** I have this code on Advanced tab-> Custom Nginx Configuration that accounts for SPA routes ```nginx proxy_intercept_errors on; error_page 404 = /index.html; ``` This was working on 2.9.9, upgraded to latest and now I have 404 **Nginx Proxy Manager Version** 2.9.12 **To Reproduce** Steps to reproduce the behavior: 1. use SPA routes with this code **Expected behavior** Simple page reload
kerem 2026-02-26 06:36:11 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@dodanex commented on GitHub (Dec 28, 2021):

I am having the same problem!
@Rod-O have you figured out how to redirect to index.html for SPA apps?

<!-- gh-comment-id:1002103966 --> @dodanex commented on GitHub (Dec 28, 2021): I am having the same problem! @Rod-O have you figured out how to redirect to index.html for SPA apps?
Author
Owner

@Rod-O commented on GitHub (Dec 28, 2021):

No, I just use 2.9.9

<!-- gh-comment-id:1002105370 --> @Rod-O commented on GitHub (Dec 28, 2021): No, I just use 2.9.9
Author
Owner

@dodanex commented on GitHub (Dec 28, 2021):

hei @Rod-O , I found a solution, works in v2.9.13 (now latest) also.
Enter this in your Advanced Custom Nginx Configuration:

proxy_intercept_errors on;
error_page 404 /index.html;
location = /index.html {
        proxy_pass http://your-docker-service-or-internal-ip;
}

Replace the proxy_pass with your app.
I don't know if this is the best solution but this is all I have working.
Hope this will help you and others that have the same problem !

<!-- gh-comment-id:1002211690 --> @dodanex commented on GitHub (Dec 28, 2021): hei @Rod-O , I found a solution, works in v2.9.13 (now latest) also. Enter this in your Advanced Custom Nginx Configuration: ```nginx proxy_intercept_errors on; error_page 404 /index.html; location = /index.html { proxy_pass http://your-docker-service-or-internal-ip; } ``` Replace the proxy_pass with your app. I don't know if this is the best solution but this is all I have working. Hope this will help you and others that have the same problem !
Author
Owner

@chaptergy commented on GitHub (Dec 29, 2021):

Does the issue still exist in 2.9.13?

<!-- gh-comment-id:1002513194 --> @chaptergy commented on GitHub (Dec 29, 2021): Does the issue still exist in 2.9.13?
Author
Owner

@Rod-O commented on GitHub (Dec 29, 2021):

@dodanex tested a workaround for 2.9.13, which means that still exists in 2.9.13

<!-- gh-comment-id:1002686336 --> @Rod-O commented on GitHub (Dec 29, 2021): @dodanex tested a workaround for 2.9.13, which means that still exists in 2.9.13
Author
Owner

@chaptergy commented on GitHub (Dec 29, 2021):

I've tried debugging why this error occurs for the past hour but unfortunately I was not able to find anything and have no clue what might cause this

<!-- gh-comment-id:1002687572 --> @chaptergy commented on GitHub (Dec 29, 2021): I've tried debugging why this error occurs for the past hour but unfortunately I was not able to find anything and have no clue what might cause this
Author
Owner

@Rod-O commented on GitHub (Dec 29, 2021):

what's your environment ?
set a redirect on your main app page to a route like in a classic react app (not on the proxy manager)
www.example.com -> www.example.com/main/section

<!-- gh-comment-id:1002695080 --> @Rod-O commented on GitHub (Dec 29, 2021): what's your environment ? set a redirect on your main app page to a route like in a classic react app (not on the proxy manager) www.example.com -> www.example.com/main/section
Author
Owner

@dodanex commented on GitHub (Dec 29, 2021):

Also, try to deactivate Force SSL and HTTP/2 Support and try again to see if it works. I had some problems with v2.9.12 because of that, but on a different VPS I use v2.9.13 with those options activated and it works.

<!-- gh-comment-id:1002695401 --> @dodanex commented on GitHub (Dec 29, 2021): Also, try to deactivate Force SSL and HTTP/2 Support and try again to see if it works. I had some problems with v2.9.12 because of that, but on a different VPS I use v2.9.13 with those options activated and it works.
Author
Owner

@chaptergy commented on GitHub (Dec 29, 2021):

I am using a random website, currently based.cooking and proxying that. I have added the error page to be /rss.xml and am able to replicate the issue that way. However I am not finding the source of this issue. I have both force ssl and http 2 support disabled, so that can't be the issue.

In case anyone without a SPA wants to replicate this, here is my full server config block I use:

server {
  set $forward_scheme https;
  set $server         "based.cooking";
  set $port           443;

  listen 80;
  listen [::]:80;

  server_name test1.npm.local;

  access_log /data/logs/proxy-host-1_access.log proxy;
  error_log /data/logs/proxy-host-1_error.log warn;

  proxy_intercept_errors on;
  error_page 404 = /rss.xml;

  location / {
    # Proxy!
    include conf.d/include/proxy.conf;
  }
}
<!-- gh-comment-id:1002719533 --> @chaptergy commented on GitHub (Dec 29, 2021): I am using a random website, currently [based.cooking](https://based.cooking) and proxying that. I have added the error page to be `/rss.xml` and am able to replicate the issue that way. However I am not finding the source of this issue. I have both force ssl and http 2 support disabled, so that can't be the issue. In case anyone without a SPA wants to replicate this, here is my full server config block I use: ```nginx server { set $forward_scheme https; set $server "based.cooking"; set $port 443; listen 80; listen [::]:80; server_name test1.npm.local; access_log /data/logs/proxy-host-1_access.log proxy; error_log /data/logs/proxy-host-1_error.log warn; proxy_intercept_errors on; error_page 404 = /rss.xml; location / { # Proxy! include conf.d/include/proxy.conf; } } ```
Author
Owner

@github-actions[bot] commented on GitHub (Mar 1, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:1972305824 --> @github-actions[bot] commented on GitHub (Mar 1, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Apr 14, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2800302087 --> @github-actions[bot] commented on GitHub (Apr 14, 2025): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1199
No description provided.