webmin / authentic-theme

Official theme for the best server management panel of the 21st Century
https://authentic-theme.com
MIT License
947 stars 163 forks source link

The page isn't redirecting properly #247

Closed hmrodrigues closed 9 years ago

hmrodrigues commented 9 years ago

After updating to version 16, after the login gives the error The page isn't redirecting properly. Both Firefox and Midori give the error.

I'm using CentOS 7

iliajie commented 9 years ago

You should hard reset your browser's cache and restart Webmin.

hmrodrigues commented 9 years ago

@qooob already did it. It says to many redirects

iliajie commented 9 years ago

What about putting cursor to URL line in Firefox and hitting enter? That shouldn't be the theme's case really..

hmrodrigues commented 9 years ago

@qooob since was on a virtual machine, I recover from a snapshot without webmin and after the update of the theme the problem happened again

iliajie commented 9 years ago

Could you please try Chrome browser? Did you also try rebooting your machine?

In case it happens in Chrome, please make a screenshot from Chrome with DevTools opened.. I really have no idea why this could be happening.

Worth checking:

http://www.howtogeek.com/forum/topic/firefox-error-the-page-isnt-redirecting-properly

https://support.mozilla.org/en-US/questions/985967

zamolxe commented 9 years ago

I can confirm the same issue Running CentOS7 Tested using Firefox and Safari on Mac (cleaned cache and cookies)

screen shot 2015-09-19 at 13 45 32
iliajie commented 9 years ago

There is also Webmin cache. It could get stuck. Clear server side cache as well.

https://support.mozilla.org/en-US/questions/938531

What is your Webmin version, guys?

zamolxe commented 9 years ago

I cleaned everything that could be cleaned, same behaviour. Webmin 1.760. Below is a snapshot of the webmin debug log (all logging enable), and the log goes on with same entries until firefox/safari stops trying to load the page.

4719 [19/Sep/2015 13:38:29.004928] - 10.10.0.58 - START "script=index.cgi" 4719 [19/Sep/2015 13:38:29.005235] - 10.10.0.58 - READ "/etc/webmin/miniserv.conf" 4719 [19/Sep/2015 13:38:29.005738] root 10.10.0.58 - READ "/usr/libexec/webmin/authentic-theme/config" 4719 [19/Sep/2015 13:38:29.007453] root 10.10.0.58 - READ "/usr/libexec/webmin/lang/en.UTF-8" 4719 [19/Sep/2015 13:38:29.008967] root 10.10.0.58 - READ "/etc/webmin/custom-lang" 4719 [19/Sep/2015 13:38:29.009169] root 10.10.0.58 - READ "/etc/webmin/custom-lang.en.UTF-8" 4719 [19/Sep/2015 13:38:29.018060] root 10.10.0.58 - READ "/usr/libexec/webmin/authentic-theme/lang/en.UTF-8" 4719 [19/Sep/2015 13:38:29.019280] root 10.10.0.58 - READ "/etc/webmin/authentic-theme/custom-lang" 4719 [19/Sep/2015 13:38:29.019509] root 10.10.0.58 - READ "/etc/webmin/authentic-theme/custom-lang.en.UTF-8" 4719 [19/Sep/2015 13:38:29.020702] root 10.10.0.58 - READ "/usr/libexec/webmin//defaultacl" 4719 [19/Sep/2015 13:38:29.020952] root 10.10.0.58 - READ "/etc/webmin/root.acl" 4719 [19/Sep/2015 13:38:29.021193] root 10.10.0.58 - READ "/etc/webmin//root.acl" 4719 [19/Sep/2015 13:38:29.021422] root 10.10.0.58 - READ "/etc/sysconfig/network" 4719 [19/Sep/2015 13:38:29.021788] root 10.10.0.58 - CMD "cmd=hostname" 4719 [19/Sep/2015 13:38:29.025883] root 10.10.0.58 - READ "/usr/libexec/webmin/virtual-server/module.info" 4719 [19/Sep/2015 13:38:29.073748] root 10.10.0.58 - READ "/usr/libexec/webmin/server-manager/module.info" 4719 [19/Sep/2015 13:38:29.085647] root 10.10.0.58 - READ "/etc/webmin/module.infos.cache" 4719 [19/Sep/2015 13:38:29.108561] root 10.10.0.58 - READ "/etc/webmin/installed.cache" 4719 [19/Sep/2015 13:38:29.119455] root 10.10.0.58 - READ "/usr/libexec/webmin/acl/module.info" 4719 [19/Sep/2015 13:38:29.119916] root 10.10.0.58 - READ "/etc/webmin/webmin.cats" 4719 [19/Sep/2015 13:38:29.120124] root 10.10.0.58 - READ "/etc/webmin/webmin.descs" 4719 [19/Sep/2015 13:38:29.120768] root 10.10.0.58 - READ "/usr/libexec/webmin/change-user/module.info" 4719 [19/Sep/2015 13:38:29.121586] root 10.10.0.58 - READ "/etc/webmin/authentic-theme/favorites.json" 4719 [19/Sep/2015 13:38:29.132471] root 10.10.0.58 - READ "/usr/libexec/webmin//module.info" 4719 [19/Sep/2015 13:38:29.133591] root 10.10.0.58 - STOP "runtime=0"

iliajie commented 9 years ago

Can you manually downgrade to let's say version 14 to see what will happen then? https://github.com/qooob/authentic-theme/raw/master/.build/authentic-theme-14.00.wbt.gz

I guess you could manually remove Webmin session by deleting /var/webmin/sessiondb.pag

I don't see how this issue is related to the theme.

zamolxe commented 9 years ago

I downgraded to version 14. Works without any problems as before.

iliajie commented 9 years ago

Can you also clear the cookies? If not just run it in incognito mode, click Ctrl+Shift+N (for Chrome), does it work then?

zamolxe commented 9 years ago

Tried the incognito mode v14: works v16: same behaviour, redirect loop

iliajie commented 9 years ago

Reply from Firefox Forums:

To solve this problem there is no need to delete all of your cookies, simply delete the ones associated with your google and youtube accounts. Here's how:

  • Click Tools/Options/Privacy
  • Click "Remove Individual Cookies"
  • In the Cookies Window type "accounts" (no quotes) into the Search box
  • Select all the cookie names starting with: accounts.google.com and accounts.youtube.com
  • Click Remove Cookie

You should now be able to reach your Gmail or Youtube login page as usual. This is how I was able to solve my problem. Deleting other google.com and youtube.com cookies did not help, only after I deleted the account cookies I was able to get back to the login page.

iliajie commented 9 years ago

I tried different versions of Firefox in Linux, OS X, Windows - I can not reproduce the bug.

Please be kind making video screencast for the whole process of signin in, while keeping DevTools opened. (you can send it to me privately in case you are worried about URLs or make it in full-screen mode).

I have no clue why this is happening and I have very strong premonition that it's not theme related!

zamolxe commented 9 years ago

I hope your premonition is right :) Anyhow, I did a screen cast so you can see what I see, below is the link https://youtu.be/c7mjJFtxY9g

andreychek commented 9 years ago

I've been doing some testing on various browsers, and so far I haven't been able to reproduce this issue.

I'll continue reviewing the issue, though I may ask Jamie to see if he has any input.

iliajie commented 9 years ago

Ok, I think I know where the problem lies! You shouldn't use that module to change the theme.

Please goto Webmin->Webmin Configuration->Themes. After you set Authentic Theme globally and see nice login (Authentic Theme login screen) - you will be fine!

Try it and let me know. Make sure that in Webmin->Change Language and Theme you have default theme set first. Then do procedure above!

Helped?

zamolxe commented 9 years ago

Well... Tried the above, exactly as described by you. Now I get the nice looking login, but after the login goes again in the loop.

iliajie commented 9 years ago

That should not be happening! :|

iliajie commented 9 years ago

I can not reproduce it on and browser, in any OS.

zamolxe commented 9 years ago

Well I'm pretty sure it's not the browser... It's something happening within webmin+authentic theme. I will try running some stack traces on webmin se wtf is doing

zamolxe commented 9 years ago

Do you have any dependencies on any perl modules or anything within webmin ? What can differ between our environments is that mine is a fresh one, with webmin 1.760 installed. I've tried removing the theme completely also clean all traces of it from the fs/cache and installed directly the v16... still no go. cleaned again... installed v15.51... that one works fine.

iliajie commented 9 years ago

That is so wired. Reboot the system!! I think personally, it's stuckness of Webmin cache somewhere..

iliajie commented 9 years ago

Did you try Chrome?

zamolxe commented 9 years ago

Tried Firefox, Safari, Chrome ( Mac OS X ) v15.51 works fine v16.00 redirect loop I suspect some dependency to something which was left around in webmin before 1.760, because I installed directly the latest version... otherwise, don't know how big are the changes between 15.51 and 16. Forgot to mention, I also rebooted the webmin machine...

iliajie commented 9 years ago

Changes are huge! Installed directly? Using Webmin->Webmin Configuration->Themes and then install theme?

zamolxe commented 9 years ago

Yes

iliajie commented 9 years ago

I don't know why it's happening. Will see what others will say on testing! Please wait..

andreychek commented 9 years ago

I don't imagine you have a machine experiencing this issue, that we could remotely access and log in to? A test system, perhaps?

zamolxe commented 9 years ago

@qooob You are not alone there :) You can try to reproduce my environment: Clean CentOS7 install (up to date), then install the webmin-1.760 rpm... That should come with v14 of your theme... Just upgrade to the latest one... I think you will get the same results like me. I can also provide the list of rpm's installed.

@andreychek I can bring one machine up for testing and grant access to that one.. (if I will reproduce the issue)

iliajie commented 9 years ago

@zamolxe what is the output of ls -lsaZ /usr/libexec/webmin/authentic-theme and ls -lsaZ /etc/webmin/authentic-theme, post it please!?

zamolxe commented 9 years ago

You have it below... selinux is disable on my end. ls -lsaZ /usr/libexec/webmin/authentic-theme /etc/webmin/authentic-theme/ /etc/webmin/authentic-theme/: total 12 drwxr-xr-x root root ? . drwxr-xr-x root root ? .. -rw-r--r-- root root ? config

/usr/libexec/webmin/authentic-theme: total 300 drwxr-xr-x root root ? . drwxr-xr-x root root ? .. -rwxr-xr-x root root ? authentic-lib.cgi -rwxr-xr-x root root ? authentic.pl -rwxr-xr-x root root ? buttons.cgi -rw-r--r-- root root ? CHANGELOG.md -rwxr-xr-x root root ? changelog.pl -rw-r--r-- root root ? config drwxr-xr-x root root ? images -rwxr-xr-x root root ? index.cgi drwxr-xr-x root root ? lang drwxrwxr-x root root ? lib -rw-r--r-- root root ? LICENSE -rwxr-xr-x root root ? navigation.cgi -rw-r--r-- root root ? README.md -rwxr-xr-x root root ? session_login.cgi -rwxr-xr-x root root ? settings.cgi -rwxr-xr-x root root ? settings-editor_read.cgi -rwxr-xr-x root root ? settings-editor_write.cgi -rwxr-xr-x root root ? settings-favorites_save.cgi -rwxr-xr-x root root ? settings-upload.cgi -rwxr-xr-x root root ? settings-upload_save.cgi -rwxr-xr-x root root ? sysinfo.cgi -rw-r--r-- root root ? theme.info drwxr-xr-x root root ? unauthenticated -rw-r--r-- root root ? VERSION.txt

iliajie commented 9 years ago

Everything looks alright!

zamolxe commented 9 years ago

I've got some updates: Trying to query the root (/) ends up with the loop, but if I try to access only a module, in my case the dhcpd configuration (/dhcpd/) that works just fine. I suspect something in authentic-lib.cgi in "sub init {"...

iliajie commented 9 years ago

What do you mean by Trying to query the root? How do you query it?

iliajie commented 9 years ago

ahh.. looking..

iliajie commented 9 years ago

Ok, can you please find the line 2008 in authentic-lib.cgi and add after &header($title) the following:

prt($ENV{'REQUEST_URI'})

Now, please go to sub init and completely comment out/remove this:

# Redirect user away, in case requested mode can not be satisfied
    if (   $ENV{'REQUEST_URI'} ne '/'
        && $ENV{'REQUEST_URI'} ne '/?virtualmin'
        && $ENV{'REQUEST_URI'} ne '/?cloudmin'
        && $ENV{'REQUEST_URI'} ne '/?mail'
        && $ENV{'REQUEST_URI'} ne '/?dashboard'
        && index( $ENV{'REQUEST_URI'}, 'xhr' ) lt 0 )
    {
        my $webmin
            = ( $ENV{'HTTPS'} ? 'https://' : 'http://' )
            . $ENV{'HTTP_HOST'} . '/';
        print "Location: $webmin\n\n";
    }
    elsif (
        ( $t_uri_virtualmin != -1 && !&foreign_available("virtual-server") )
        || ( $t_uri_cloudmin != -1 && !&foreign_available("server-manager") )
        || ($t_uri_webmail != -1
            && (&get_product_name() ne 'usermin'
                || ( &get_product_name() eq 'usermin'
                    && !&foreign_available("mailbox") )
            )
        )
        )
    {
        print "Set-Cookie: redirect=0; path=/\r\n";
        my $webmin
            = ( $ENV{'HTTPS'} ? 'https://' : 'http://' )
            . $ENV{'HTTP_HOST'} . '/';
        print "Location: $webmin\n\n";
    }

Afterwards, reload the page. What is the output of the printed $VAR1 that we added to the line 2009?

zamolxe commented 9 years ago

Are you sure is prt($ENV{'REQUEST_URI'}) and not print ?

iliajie commented 9 years ago

Yes, I got that manual function there..

iliajie commented 9 years ago

It's better to find printed stuff..

zamolxe commented 9 years ago

HTTP/1.0 500 Perl execution failed Server: MiniServ/1.760 Date: Sun, 20 Sep 2015 11:53:28 GMT Content-type: text/html; Charset=iso-8859-1 Connection: close Error - Perl execution failed

Undefined subroutine &main::prt called at /usr/libexec/webmin/authentic-theme/authentic-lib.cgi line 2009.

iliajie commented 9 years ago

Like I said :) It's cache issue! In the end of the file there should be

sub prt {
    my ($____v) = @_;
    use Data::Dumper;
    print '<div style="color: red">';
    print Dumper $____v;
    print '</div>';
}

Do you have this in your file? Did you really restart Webmin? Did you restart machines? (please say as it is, I need it for the future reference)

You could get error about not having use Data::Dumper.

Take a look at this line: https://github.com/qooob/authentic-theme/blob/master/authentic-lib.cgi#L2358

OK instead of prt($ENV{'REQUEST_URI'}) do this:

print '++++' . $ENV{'REQUEST_URI'} . '++++';

What is the output?

iliajie commented 9 years ago

In case you have / from $ENV{'REQUEST_URI'}, just manually update your .lib file and restart Webmin.

zamolxe commented 9 years ago

If I query https://1.2.3.4:10000 the output is / and the loop is gone.

iliajie commented 9 years ago

But what do you query on regular basis?

iliajie commented 9 years ago

This is what you should do?

zamolxe commented 9 years ago

Usually I go directly yo https://1.2.3.4:10000/ and sometimes directly to https://1.2.3.4:10000/dhcpd There is nothing fancy about the queries

iliajie commented 9 years ago

Second will never work!!

What do you get on the print if you query the first example: https://1.2.3.4:10000/ ?

iliajie commented 9 years ago

Actually, if I query https://1.2.3.4:10000/fsdump/ it works without left menu. I wouldn't recommend doing this. Why not just query https://1.2.3.4:10000... However https://1.2.3.4:10000/ works also just fine in my case.

zamolxe commented 9 years ago

Ok.. I found out the root cause... After installing perl-Data-Dumper to get your function working... Everything worked without any issues. Just to confirm, I removed perl-Data-Dumper... got back the loop... Can someone else confirm this ?