Post by alexmitev » Wed Nov 02, 2011 8:04 pm

First to say, this is not a bug, but behaviour with undesired side effetcs.
I created a custom traffic logger for OpenCart, and I noticed that I get a lot url requests like
http://store.com/categoryXXX/[b]catalog ... ault/image...[/b]
http://store.com/productXXX/[b]catalog/ ... pt/jquery/...[/b]
Of course, those are invalid URLs, and that's why they were logged.
Furhter investigation showed that some browsers (I cannot tell exactly which) don't recognize the base tag, and treat relative URLs like 'catalog/view/javascript/jquery/...' relative to the current page istead of relative to the base tag and produce such invalid requests.
This resolves in calling the index.php for every invalid file, which generates a lot of server load, as it executes all SQLs, etc.
I've already solved the problem on my store http://bglotos.com/, so I'm not asking for support, just wanted to mention this for the sake of improving OC :)

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by Xsecrets » Wed Nov 02, 2011 8:14 pm

care to share how you solved the problem?

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by alexmitev » Wed Nov 02, 2011 8:41 pm

I set

Code: Select all

$this->data['base']
inside all controllers whose templates require an absolute path, and then instead of

Code: Select all

'catalog/...' 
I use

Code: Select all

'<?php echo $base; ?>catalog/...'
The change is required also for all css and js files.
Then, for the ajax requests I have declared a global "base" variable in the head, so all ajax request become

Code: Select all

url: base + 'index.php?route=...'
I guess the $base variable can be made public, I'm not sure how to do this, there's already an existing document->base variable

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by Xsecrets » Wed Nov 02, 2011 9:07 pm

alexmitev wrote:I set

Code: Select all

$this->data['base']
inside all controllers whose templates require an absolute path, and then instead of

Code: Select all

'catalog/...' 
I use

Code: Select all

'<?php echo $base; ?>catalog/...'
The change is required also for all css and js files.
Then, for the ajax requests I have declared a global "base" variable in the head, so all ajax request become

Code: Select all

url: base + 'index.php?route=...'
I guess the $base variable can be made public, I'm not sure how to do this, there's already an existing document->base variable
how does this make browsers that don't use base use base if all you did was hard code the variable?

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by alexmitev » Wed Nov 02, 2011 9:28 pm

Of course, I removed the html base tag from the head section, so that all browsers use full paths

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by Daniel » Thu Nov 03, 2011 1:14 pm

this was fixed in 1.5.1.1

the problem was there were some missing files and using seo urls.

it was fixed by removing the js links to the missing images.


might be better using htaccess to ignore requests for missing images.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by alexmitev » Thu Nov 03, 2011 7:17 pm

Daniel wrote: this was fixed in 1.5.1.1

the problem was there were some missing files and using seo urls.

it was fixed by removing the js links to the missing images.


might be better using htaccess to ignore requests for missing images.
Daniel, I think you don't understand the issue. I didn't get requests only for missing files, but for files that were actually on the server, but got requested with the wrong url. And those wrong requests were 90% of all requests :)
I see the online demo still uses the base tag, maybe it's not current?
Correct me if I'm wrong.

I think it's better not to create such requests instead of ignoring them in the htaccess file (I have to put all gif, jpg, bmp, png, css, js files there, and index.php too!)

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by dony_b » Thu Nov 03, 2011 9:42 pm

I think this happens in IE6 and down ....

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by Daniel » Sun Nov 06, 2011 1:47 am

base tag would not cause course server loads. it will be something else.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by rpmb » Sun Nov 06, 2011 4:34 am

LOL base tag causing high server loads. Its not going to be the case as Daniel has stated.

You need to start looking at what could be the problem. Mysql slow query logging could be a good place to start to see if there is anything database related which would send the cpu high.

opencart 3.0.2.0


User avatar
New member

Posts

Joined
Wed Jun 30, 2010 9:13 pm
Location - Cornwall

Post by alexmitev » Tue Nov 08, 2011 2:48 am

rpmb wrote:LOL base tag causing high server loads. Its not going to be the case as Daniel has stated.
As I said, the only change I made was use absolute instead of relative URLs and remove the base tag, and the wrong requests are gone! So for me it's obvious what's causing the problems.
Once again, it's such a pin in the a** convincing you to improve OC.. as always. I guess I'll just stop reporting isses.

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by Daniel » Tue Nov 08, 2011 2:05 pm

you not helping me improve opencart because you don't know what you are talking about.

if something is missing and causing the high cpu loads then find what is missing then remove the code for it.

the base tag is required. if you remove it you will find other things might stop working.

if you are using seo urls with a missing base tag this will cause problems.

ie6 and ie7 are trying to load transparent images that don;t exists and being redirect to the homepage. this only happens when seo urls are on. this is whats causing the problem. i have already moved the links to these files in the latest version.

try using fiddler to find out exactly what is causing the problem instead of using uneducated guess work.

i don;t have time to fully explain how wrong your suggestion is.

when you know programming then come back.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm
Who is online

Users browsing this forum: No registered users and 42 guests