[phpBB3] Nginx upgrade causes redirect loop

Magic SEO URLs for phpBB.
redburn
Posts: 12
Joined: Sun Apr 24, 2011 8:06 am

[phpBB3] Nginx upgrade causes redirect loop

Postby redburn » Wed May 09, 2012 1:39 pm

I have a phpBB3 forum running on Apache (port 8080), with Nginx as the reverse proxy for static content (on port 80). This was all working fine until I tried upgrading Nginx to the latest version (1.2.0). After upgrading, the homepage gets stuck in an endless loop of 301 redirects. This only affects the homepage, all other pages are still working, and this only happens when the Magic SEO URLs plug-in is enabled -- when I disable it, the homepage works fine, but all other forum URLs are obviously not rewritten.

Do you have any ideas as to what in Magic SEO URLs could be causing the homepage to endlessly redirect to itself? The Apache mod_rewrite rules haven't changed. Unfortunately, I cannot show this in action, because then my forum homepage would be inaccessible. I've downgraded Nginx back to the previous stable release, but would like to be able to upgrade.

Any help would be appreciated. Perhaps you can point me in a direction so that I can continue investigating. Currently, I'm stuck.

inveo
Inveo Support
Posts: 1285
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: [phpBB3] Nginx upgrade causes redirect loop

Postby inveo » Wed May 09, 2012 2:07 pm

If you mean by "disabling" commenting out installation line in common.php file and leaving .htaccess file intact then it seems there is a bug in Nginx - some server vars are getting incorrect values.
Link to phpinfo.php page would help in pointing what exactly is going wrong there.

redburn
Posts: 12
Joined: Sun Apr 24, 2011 8:06 am

Re: [phpBB3] Nginx upgrade causes redirect loop

Postby redburn » Thu May 10, 2012 2:22 am

It's a strange problem, the cause of which must be somewhere in the middle between Magic SEO URLs and the new Nginx, but I don't think I'll ever get to it. I've compared the server variables and headers, but don't see anything that could cause this. However, since it's only affecting the homepage, I managed to come up with a workaround:

Code: Select all

        if ($request_filename ~ \/$) {
                return  404;
        }

This returns a 404 for every hit to http://www.example.com/ only (i.e. the homepage), and for every 404 I have a fallback function like this, redirecting to Apache:

Code: Select all

        error_page      404 = @fallback;

        location @fallback {

                proxy_pass                              http://127.0.0.1:8080;

        }

It works, so I'm happy. Thanks for your time.