Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

Redirect loop after setup #649

Closed
Sonof8Bits opened this issue Jul 7, 2016 · 18 comments
Closed

Redirect loop after setup #649

Sonof8Bits opened this issue Jul 7, 2016 · 18 comments
Labels

Comments

@Sonof8Bits
Copy link

After setting up my first account I'm stuck in a redirect loop. Chrome gives me ERR_TOO_MANY_REDIRECTS.

Any ideas what could be causing it or how to fix it?

@jamesrascal
Copy link

Can you post your Nginx Config please?

@Sonof8Bits
Copy link
Author

Sonof8Bits commented Jul 7, 2016

Apache even. Some background info: I did the exact same thing on a Raspberry Pi, including https, a year ago and it worked perfectly. But as you can imagine a RasPi was incredibly slow to load. So now I'm trying again on a VPS. The apache config is identical to the RasPi install.

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName paperwork.my.site
        DocumentRoot /var/www/paperwork.my.site/paperwork/frontend/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/paperwork.my.site/paperwork/frontend/public/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        SSLEngine on
        SSLCertificateFile      /etc/letsencrypt/live/paperwork.my.site/cert.pem
        SSLCertificateKeyFile   /etc/letsencrypt/live/paperwork.my.site/privkey.pem
        SSLCertificateChainFile /etc/letsencrypt/live/paperwork.my.site/fullchain.pem

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>
        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>

@TiborBiro
Copy link

TiborBiro commented Jul 8, 2016

A quick hack that got things going for me:

I got the same problem. The nginx error.log was showing something like Undefined index: HTTP_X_REQUESTED_WIDTH in index.php. If you check the index.php file you see a multi-line test that determines if setup.php needs to be loaded.

After some fiddling I just replaced the test with (1==2) so it is always false and the redirects stopped. Do this after you already ran setup.php once.

@Sonof8Bits
Copy link
Author

That did the trick! I commented out the check and replaced it with (1==2){.

If someone runs into the same problem, here's the entire index.php file for your copy and paste pleasure:

<?php

    /** Check if all config lines are present.
     * If not, either the installation is damaged
     * or installation has not been done. Run the
     * Setup Wizard.
     */

    if (1==2){
    /*(!file_exists("../app/storage/config/setup") ||
        file_get_contents("../app/storage/config/setup") == 3 && !$_SERVER['HTTP_X_REQUESTED_WITH'] ||
        file_get_contents("../app/storage/config/setup") == 4 && !$_SERVER['HTTP_X_REQUESTED_WITH'] ||
        file_get_contents("../app/storage/config/setup") == 6 && !$_SERVER['HTTP_X_REQUESTED_WITH'] ||
        file_get_contents("../app/storage/config/setup") == 5 && !$_SERVER['HTTP_X_REQUESTED_WITH'] ||
        !file_exists("../app/storage/config/paperwork.json") && !$_SERVER['HTTP_X_REQUESTED_WITH'] ||
        !file_exists("../app/storage/config/database.json") && !$_SERVER['HTTP_X_REQUESTED_WITH']) {
            header("Location: setup.php");*/
    }else{
        /**
         * Laravel - A PHP Framework For Web Artisans
         *
         * @package  Laravel
         * @author   Taylor Otwell <taylorotwell@gmail.com>
         */

        /*
        |--------------------------------------------------------------------------
        | Register The Auto Loader
        |--------------------------------------------------------------------------
        |
        | Composer provides a convenient, automatically generated class loader
        | for our application. We just need to utilize it! We'll require it
        | into the script here so that we do not have to worry about the
        | loading of any our classes "manually". Feels great to relax.
        |
        */

        require __DIR__.'/../bootstrap/autoload.php';

        /*
        |--------------------------------------------------------------------------
        | Turn On The Lights
        |--------------------------------------------------------------------------
        |
        | We need to illuminate PHP development, so let's turn on the lights.
        | This bootstraps the framework and gets it ready for use, then it
        | will load up this application so that we can run it and send
        | the responses back to the browser and delight these users.
        |
        */

        $app = require_once __DIR__.'/../bootstrap/start.php';

        /*
        |--------------------------------------------------------------------------
        | Run The Application
        |--------------------------------------------------------------------------
        |
        | Once we have the application, we can simply call the run method,
        | which will execute the request and send the response back to
        | the client's browser allowing them to enjoy the creative
        | and wonderful application we have whipped up for them.
        |
        */

        $app->run();
    }

@jamesrascal
Copy link

In my opinion, this is a bug that needs to be addressed. I was running through an install this morning and found the same problem.

@Liongold
Copy link
Contributor

Thanks for your feedback. On what branch is this issue happening? Also, can someone of you give the version when this is happening (as found in the Settings page) please? Does this happen only when using HTTPS? A screenshot of the Network tab of the browser's Developer Tools could also help. Are any of the request failing? Last thing, at what step is the error happening? To see this, go to the storage folder on your version, config folder and give the number written in the file named setup. Sorry for the questions but these should help with identifying the problem.

@Liongold
Copy link
Contributor

Also, try to not change the code. You can skip the Setup Wizard by putting 8 in the setup file I mentioned above.

@Sonof8Bits
Copy link
Author

Master branch. Don't know if it's https only. It happens right after the setup wizard is done and you click continue to paperwork. I hope some others can supply more info.

@Sonof8Bits
Copy link
Author

Wait, I did try http, also looped.

@Liongold
Copy link
Contributor

Can someone post a screenshot of the Network tab and the Console of the Developer Tools?

@Liongold
Copy link
Contributor

A pull request is open which should avoid this issue. However, this could happen due to an incorrectly done install. Please recheck that you have all files present.

@Sonof8Bits
Copy link
Author

I redownloaded the master.zip about 3 times before @TiborBiro's hack fixed it. I don't think that's the issue for me.

@Liongold
Copy link
Contributor

The one generated by Github? If yes, then that is not the way Paperwork should be installed. There's some instructions in the Wiki. Also, develop contains the latest code so fixes may get later in the master branch.

@Sonof8Bits
Copy link
Author

I have also tried the git method, but currently I'm running the install from the github zip.

@Sonof8Bits
Copy link
Author

If there's any way I can contribute with making a debian8 / apache page for the wiki, let me know.

@Liongold
Copy link
Contributor

If you want to, you can contribute a guide.

@Liongold
Copy link
Contributor

Can you confirm whether this is happening on the develop branch please?

@teward
Copy link

teward commented Aug 5, 2016

Just confirmed today this happens in the Master branch via a Docker setup/install. I'll test Develop to see if this can be replicated in the Develop branch later (within the next three days, schedule permitting)

@mrusme mrusme added the 1 Paperwork v1 label May 3, 2019
@mrusme mrusme closed this as completed May 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants