Skip to content

500 Internal Server Error after NextJS router.refresh() #2615

@andood

Description

@andood

I have a NextJS 14 app hosted on Apache using Passenger.

When a route (other than the root path) is refreshed via code with router.refresh() or refreshed manually in the browser, the server throws a generic 500 Internal Server Error:
Image

The log file shows:

[Mon Jun 02 14:45:47.545905 2025] [core:error] [pid 1153606:tid 1153663] [remote IP] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://domain.com/path?type=open

Conf override generated by Passenger in WHM (via cPanel Application Manager):

#  /etc/apache2/conf.d/userdata/ssl/2_4/user/domain.com/account.conf
<Location "/">
    <IfModule mod_env.c>
        SetEnv "APP_VERSION" "0.1-alpha"
    </IfModule>

    <IfModule mod_passenger.c>
        PassengerAppEnv "production"

        PassengerEnabled on
        PassengerBaseURI "/"
        PassengerAppRoot "/home/user/public_html/domains/path"
        PassengerAppGroupName "user - account def"
        PassengerRuby /usr/bin/ruby
        PassengerPython /usr/bin/python-html2text
        PassengerNodejs /opt/cpanel/ea-nodejs20/bin/node
    </IfModule>
</Location>
<Directory "/home/user/public_html/domains/path">
    Allow from all
    Options -MultiViews
    Options -Indexes
    Require all granted
</Directory>

Server Info:
AlmaLinux v9.6.0
Apache 2.4
Passenger Version: 6.0.27
Node v20.19.2

Any guidance much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions