Nginx Showing 404 in Header Despite Page Rendering Fine (CentOS, aaPanel, CodeIgniter 4)

I’m experiencing a strange issue where the page at
https://customsportswears.com/ibc52/custom-afl-uniforms-high-quality-australian-football-league-gear.html
loads fine in the browser, but when checked via developer tools or external services, the HTTP response header is 404.

Stack:

  • CentOS (aaPanel)
  • Nginx 1.24.0
  • PHP 8.3 (via PHP-FPM)
  • CodeIgniter 4

Current Nginx Configuration (Partial):

error_page 403 500 502 503 504 /index.php;
error_page 404 /404.php;

location = /404.php {
    internal;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index 404.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

location / {
    try_files $uri $uri/ /index.php$is_args$args;
    add_header Access-Control-Allow-Origin "*";
    add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
    add_header Access-Control-Allow-Headers "Content-Type, Authorization";
}

location ~ .php$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} ```

What's Happening:
- The actual rendered page appears correct.
- However, HTTP response header for that URL is returning a 404 status.
- Suspect CodeIgniter or nginx config may be causing this, possibly due to try_files, error_page logic, or internal redirect conflicts.
Tried:
- Confirmed that the controller and route in CI4 return content properly.
- Double-checked the file path and route configs.
- Response status mismatch suggests a misconfiguration or forced status return.
Looking for insights from anyone who's handled similar 404 header issues with CodeIgniter and nginx under aaPanel. Could it be a CI4 header override after routing logic? Or does nginx misinterpret the fallback URL?
Any help is appreciated!