How to avoid error 500 when using return 403

Discussion in 'General' started by computerwuffi, Mar 19, 2026 at 6:36 PM.

  1. computerwuffi

    computerwuffi New Member

    hello, i am using the newest ispconfig-panel with nginx on an debian13 VPS. I want to block countrys with geoip, like
    if ($blocked_country) {
    return 403;
    }
    that works fine if custom error sites not enabled. But when enabled i got error 500 instead of 403.
    I have fastcgi_intercept_errors on; in nginx.conf and tried various syntax like error_page 403 /error/403.html; in the nginx-options within ispconfig, but nothing will work for me. Does anyone have a tip on how I should proceed ? Thanks
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which exact error do you get in the website error.log file?
     
  3. computerwuffi

    computerwuffi New Member

    these errors are logged:
    2026/03/20 14:00:24 [error] 617149#617149: *7 rewrite or internal redirection cycle while internally redirecting to "/error/403.html", client: x, server: x, request: "GET / HTTP/2.0", host: "x"
    2026/03/20 14:00:25 [error] 617149#617149: *7 rewrite or internal redirection cycle while internally redirecting to "/error/403.html", client: x, server: x, request: "GET /favicon.ico HTTP/2.0", host: "x"
     
  4. computerwuffi

    computerwuffi New Member

    access.log files: the first 2 lines with custom-error sites disabled, the other lines with eneabled. In nginx logfiles is nothing to see.
    79.228.xxx.xxx - - [20/Mar/2026:13:56:44 +0100] "GET / HTTP/2.0" 403 107 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0"
    79.228.xxx.xxx - - [20/Mar/2026:13:56:44 +0100] "GET /favicon.ico HTTP/2.0" 403 107 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0"
    79.228.xxx.xxx - - [20/Mar/2026:14:00:24 +0100] "GET / HTTP/2.0" 500 170 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0"
    79.228.xxx.xxx - - [20/Mar/2026:14:00:25 +0100] "GET /favicon.ico HTTP/2.0" 500 170 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0"
     

Share This Page