ERR_TOO_MANY_REDIRECTS logging in to ocadmin
-
- Posts: 35
- Joined: Thu Dec 03, 2020 2:23 pm
- Has thanked: 18 times
- Been thanked: 2 times
ERR_TOO_MANY_REDIRECTS logging in to ocadmin
Small fault, but irritating. I log in to Ocadmin, make some changes, then it kicks me out and on trying to log in again I get "ERR_TOO_MANY_REDIRECTS" ... clearing cookies doesn't help. I wait about 10 minutes, then I am able to get in again.
I have queried hosting company first, and have been advised to check back with you if defining HTTP_SERVER with an HTTPS URL in includes/configure.php and ocadmin/includes/configure.php may be causing an issue?
Any advice?
I have queried hosting company first, and have been advised to check back with you if defining HTTP_SERVER with an HTTPS URL in includes/configure.php and ocadmin/includes/configure.php may be causing an issue?
Any advice?
-
- Lead Developer
- Posts: 2657
- Joined: Tue Nov 05, 2019 6:02 pm
- Has thanked: 4 times
- Been thanked: 182 times
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
How would putting in the correct URL cause multiple redirects?
If this is in Chrome, click the three dots button (probably in the upper right) to open the menu. Select More tools. Select Developer tools. Choose the Network tab. Now try to connect to your admin. Obviously when you are having trouble. What does it say? If there are too many redirects, I would expect something like
/index.php
/login.php
/index.php
/login.php
...
Then if that doesn't immediately show a problem, post back for more advice. You may want to screenshot the request and response headers for each different page in the loop (in this example, index.php and login.php). We may ask you to post them. Or perhaps you'll see something about which you want to ask.
If this is in Chrome, click the three dots button (probably in the upper right) to open the menu. Select More tools. Select Developer tools. Choose the Network tab. Now try to connect to your admin. Obviously when you are having trouble. What does it say? If there are too many redirects, I would expect something like
/index.php
/login.php
/index.php
/login.php
...
Then if that doesn't immediately show a problem, post back for more advice. You may want to screenshot the request and response headers for each different page in the loop (in this example, index.php and login.php). We may ask you to post them. Or perhaps you'll see something about which you want to ask.
You do not have the required permissions to view the files attached to this post.
-
- Lead Developer
- Posts: 2439
- Joined: Tue Oct 29, 2019 9:37 am
- : Buy Me A Beverage
- Has thanked: 51 times
- Been thanked: 138 times
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
You seem to be having a lot of problems, I would suggest that most of these stem from having a host who has their server set up in a non-standard way.
Do you have access to a host who knows what they are doing ?
Do you have access to a host who knows what they are doing ?
Gamechanger Addon: Queued Emails, try before you buy.
-
- Posts: 35
- Joined: Thu Dec 03, 2020 2:23 pm
- Has thanked: 18 times
- Been thanked: 2 times
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
Unfortunately no - I am pretty much committed to Hostica. They are generally pretty good at sorting out the issues when I raise them, but yes .... I am having issues.
if/when the error occurs again, I will do as you request
I am also having a PayPal issue, and was going to raise that in another thread *sigh* ... thanks for all the help - I'm slowly getting there
if/when the error occurs again, I will do as you request
I am also having a PayPal issue, and was going to raise that in another thread *sigh* ... thanks for all the help - I'm slowly getting there
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
CE Phoenix 1.0.7.11, PHP 7.4.13
I have the same issue on admin page using subdomain eshop.example.com
Subdomain folder is located at www/subdom/eshop
It works fine if it's placed to the root www/.
But there is located different CMS and I have to put Phoenix to the subfolder and set up it as a subdomain.
I have more websites with subdomains on that hosting and there's no problem.
Phoenix Catalog page works fine (incl. login) but there is some conflict on Admin login page.
I think it should by some redirect conflict but I have no idea where. I would appreciate any advice.
Both of configure.php files were generated by default installation process (not manually):
catalog/includes/config.php
catalog/admin/includes/config.php
www/.htaccess - default configuration generated by the hosting
Redirects from example.com/admin to example.com/admin/login.php seems to be ok, the loop is on the login page.
catalog/login.php is ok.
Thank you for your suggestions.
I have the same issue on admin page using subdomain eshop.example.com
Subdomain folder is located at www/subdom/eshop
It works fine if it's placed to the root www/.
But there is located different CMS and I have to put Phoenix to the subfolder and set up it as a subdomain.
I have more websites with subdomains on that hosting and there's no problem.
Phoenix Catalog page works fine (incl. login) but there is some conflict on Admin login page.
I think it should by some redirect conflict but I have no idea where. I would appreciate any advice.
Both of configure.php files were generated by default installation process (not manually):
catalog/includes/config.php
Code: Select all
const HTTP_SERVER = 'https://eshop.example.com';
const COOKIE_OPTIONS = [
'lifetime' => 0,
'domain' => 'eshop.example.com',
'path' => '/',
'samesite' => 'Lax',
'secure' => true,
];
const DIR_WS_CATALOG = '/';
const DIR_FS_CATALOG = '/data/web/virtuals/USERID/virtual/www/subdom/eshop/';
Code: Select all
const HTTP_SERVER = 'https://eshop.example.com';
const COOKIE_OPTIONS = [
'lifetime' => 0,
'domain' => 'eshop.example.com',
'path' => '/admin',
'samesite' => 'Lax',
'secure' => true,
];
const DIR_WS_ADMIN = '/admin/';
const DIR_FS_DOCUMENT_ROOT = '/data/web/virtuals/USERID/virtual/www/subdom/eshop/';
const DIR_FS_ADMIN = '/data/web/virtuals/USERID/virtual/www/subdom/eshop/admin/';
const DIR_FS_BACKUP = DIR_FS_ADMIN . 'backups/';
const HTTP_CATALOG_SERVER = 'https://eshop.example.com';
const DIR_WS_CATALOG = '/';
const DIR_FS_CATALOG = '/data/web/virtuals/USERID/virtual/www/subdom/eshop/';
Code: Select all
# htaccess rules for subdomains and aliases
# to create new subdomain, create a folder www/subdom/(subdomain name)
# to create web for alias, create a folder www/domains/(whole domain name)
RewriteEngine On
# domains (aliases)
RewriteCond %{REQUEST_URI} !^domains/
RewriteCond %{REQUEST_URI} !^/domains/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$
RewriteCond %{DOCUMENT_ROOT}/domains/%2 -d
RewriteRule (.*) domains/%2/$1 [DPI]
# subdomains (with or without www)
RewriteCond %{REQUEST_URI} !^subdom/
RewriteCond %{REQUEST_URI} !^/subdom/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)\.([^\.]*)\.([^\.]*)$
RewriteCond %{DOCUMENT_ROOT}/subdom/%2 -d
RewriteRule (.*) subdom/%2/$1 [DPI]
# aliasy - to be redirected correctly when missing /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^domains/[^/]+/(.+[^/])$ /$1/ [R]
# subdomains - to be redirected correctly when missing /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^subdom/[^/]+/(.+[^/])$ /$1/ [R]
catalog/login.php is ok.
Thank you for your suggestions.
You do not have the required permissions to view the files attached to this post.
-
- Lead Developer
- Posts: 2657
- Joined: Tue Nov 05, 2019 6:02 pm
- Has thanked: 4 times
- Been thanked: 182 times
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
And what are the request headers? Are they the same on every invocation of login.php? Or are they toggling between two values?
I find the following confusing:You describe this as a subdomain, but that is a subfolder. Mod_rewrite seems an odd place to try to implement a subdomain as a subfolder. I would expect that to occur in the base Apache configuration.
I find the following confusing:
Code: Select all
RewriteRule (.*) subdom/%2/$1 [DPI]
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
Thank you @ecartz for your response.
Their "multihosting" solution offers use more domains as aliases for one website or as independent websites via www/domains/ folder. e.g.
www/domains/example1.com
www/domains/example2.com
As well subdomains are actually just redirections to www/subdom/ subfolders. e.g.
www/subdom/subdomain1
www/subdom/subdomain2
I'll check it again. But what I don't understand is why - if there is a bug in redirection - catalog login works but admin login not.
If it would be useful I can send you FTP, it's just my sandbox.
Thank you.
Headers screenshot is attached. Headers are same for all login.php (except for red one which is just before browser's ERR_TOO_MANY_REDIRECTS page).And what are the request headers? Are they the same on every invocation of login.php? Or are they toggling between two values?
This hosting doesn't allow to use real subdomain folder on the same level as www/.You describe this as a subdomain, but that is a subfolder. Mod_rewrite seems an odd place to try to implement a subdomain as a subfolder. I would expect that to occur in the base Apache configuration.
Their "multihosting" solution offers use more domains as aliases for one website or as independent websites via www/domains/ folder. e.g.
www/domains/example1.com
www/domains/example2.com
As well subdomains are actually just redirections to www/subdom/ subfolders. e.g.
www/subdom/subdomain1
www/subdom/subdomain2
Code: Select all
RewriteRule (.*) subdom/%2/$1 [DPI]
If it would be useful I can send you FTP, it's just my sandbox.
Thank you.
You do not have the required permissions to view the files attached to this post.
-
- Lead Developer
- Posts: 2439
- Joined: Tue Oct 29, 2019 9:37 am
- : Buy Me A Beverage
- Has thanked: 51 times
- Been thanked: 138 times
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
There is a very long standing "bug" which affects SOME hosts (depending on how they have set up their server) when using osCommerce in a subdomain. It's to do with virtual mapping of folders. I can't remember the exact scenario but I do know I reported it back in 2012 or so and it was never fixed as it was determined that "get a new host" was the answer
Gamechanger Addon: Queued Emails, try before you buy.
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
That's not so much ...ehhhm... user friendly
I just remembered a time when website developers advised users what their browser and resolution should be
Not to be only sarcastic I've spent tonight trying to find a solution.
I like the installation process, it's quick and easy. But such a UX problem, which already appears during installation, can be a way to lose new users. And that should be a shame, because I think the application is really good.
Thanks to Gary for reporting that there was a known bug. This was a good starting point. Hope we can now call it fixed.
SOLVED (fixed)
admin/includes/application_top.php line 42 -44
The comparation of $_SERVER['SCRIPT_NAME'] and DIR_WS_ADMIN may cause this problem because $_SERVER['SCRIPT_NAME'] contains the subfolder(s) name(s) in its path but DIR_WS_ADMIN doesn't.
e.g.
$req['path'] = /subdom/eshop/admin/login.php subdom/eshop/admin/login.php
DIR_WS_ADMIN = '/admin/';
That's why substr() doesn't work properly in this case.
New code:
or
The first one should be little bit faster.
Hope it could help the project.
I just remembered a time when website developers advised users what their browser and resolution should be
Not to be only sarcastic I've spent tonight trying to find a solution.
I like the installation process, it's quick and easy. But such a UX problem, which already appears during installation, can be a way to lose new users. And that should be a shame, because I think the application is really good.
Thanks to Gary for reporting that there was a known bug. This was a good starting point. Hope we can now call it fixed.
SOLVED (fixed)
admin/includes/application_top.php line 42 -44
Code: Select all
// set php_self in the local scope
$req = parse_url($_SERVER['SCRIPT_NAME']);
$PHP_SELF = substr($req['path'], strlen(DIR_WS_ADMIN));
e.g.
$req['path'] = /subdom/eshop/admin/login.php subdom/eshop/admin/login.php
DIR_WS_ADMIN = '/admin/';
That's why substr() doesn't work properly in this case.
New code:
Code: Select all
// set php_self in the local scope
$PHP_SELF = basename($_SERVER['SCRIPT_NAME']);
Code: Select all
// set php_self in the local scope
$PHP_SELF = pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_BASENAME);
Hope it could help the project.
-
- Lead Developer
- Posts: 2657
- Joined: Tue Nov 05, 2019 6:02 pm
- Has thanked: 4 times
- Been thanked: 182 times
Re: ERR_TOO_MANY_REDIRECTS logging in to ocadmin
But that change won't allow for pages that aren't in the root. I.e. the whole reason why it uses substr in the first place.
A better fix would probably be to set up Apache to pass the script name to match what it is using.
Or to set up the shop in a subfolder of the original domain rather than a subdomain. Since the subdomains are set up as a mapping overtop the subfolder. So instead of doing subdomain.domain.tld/, do domain.tld/subdomain/
I'm a bit curious about why the install is producing something different actually. What's the $_SERVER['REQUEST_URI'] and $_SERVER['SCRIPT_FILENAME'] in that situation? Possibly we should be detecting this situation in the install.
A better fix would probably be to set up Apache to pass the script name to match what it is using.
Or to set up the shop in a subfolder of the original domain rather than a subdomain. Since the subdomains are set up as a mapping overtop the subfolder. So instead of doing subdomain.domain.tld/, do domain.tld/subdomain/
I'm a bit curious about why the install is producing something different actually. What's the $_SERVER['REQUEST_URI'] and $_SERVER['SCRIPT_FILENAME'] in that situation? Possibly we should be detecting this situation in the install.