Custom error pages strange behavior

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Mon Jul 02, 2007 3:36 pm    Post subject: Custom error pages strange behavior Reply with quote

Hi all!

I'm faced the trouble and I do not understand its origin.
I created custom error files written in plain html. There are links to .css and graphic files located in separate folder in the root of documents folder. IE shows those pages correctly and nothing is wrong in html directives.
At the same time when server shows those pages .css file and graphics do not load in IE.
What is it? Is it possible to include external files to custom error pages using Abyss Web Server???
Please explain!
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Jul 02, 2007 6:57 pm    Post subject: Re: Custom error pages strange behavior Reply with quote

alexey.spb,

Try checking your access.log file to see what files are actually being requested by the browser when a custom error page is shown.

Does browsing the custom error page directly make the .css file download fine?

If the problem persists, please post here the HTML source code of your custom error page.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Tue Jul 03, 2007 6:17 pm    Post subject: Reply with quote

In fact you are absolutely righ. It is IE7 bug.
There is string in log:
"GET /serv-u/files/error.css HTTP/1.1"
and I do not understand where IE picked dir serv-u up (it is located at the same level where /files/ dir located)...
At the same time html code is very simple...
I have tried o insert IP instead of relative path but result was the same - /serv-u/ before IP in log...
Also I saw this in log:
"GET /files/files/403.gif HTTP/1.1"
So IE is making cache...
It's magic and the magic is not kind! Thyank you, B.G.!

Any ideas???[/b]
Back to top View user's profile Send private message
roganty
-


Joined: 08 Jun 2004
Posts: 357
Location: Bristol, UK

PostPosted: Tue Jul 03, 2007 10:43 pm    Post subject: Reply with quote

alexey.spb wrote:
In fact you are absolutely righ. It is IE7 bug.
There is string in log:
"GET /serv-u/files/error.css HTTP/1.1"
and I do not understand where IE picked dir serv-u up (it is located at the same level where /files/ dir located)...
At the same time html code is very simple...
I have tried o insert IP instead of relative path but result was the same - /serv-u/ before IP in log...
Also I saw this in log:
"GET /files/files/403.gif HTTP/1.1"
So IE is making cache...
It's magic and the magic is not kind! Thyank you, B.G.!

Any ideas???[/b]


With error pages you have to use absolute paths
Make sure that all your links, images and style sheets start with a leading slash (/)
This tells the browser to look in the root of the site for any linking files

Also make sure you clear out the cache

Hope this helps
_________________
Anthony R

Roganty
| Links-Links.co.uk
Back to top View user's profile Send private message Visit poster's website
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Wed Jul 04, 2007 7:10 am    Post subject: Reply with quote

I have tried.
I got in GET request (according to log) something like /files/http://xxx.xxx.xxx.xxx/files/error.css
Cache was previously cleared...
So IE remembers well where it is and it is trying to use only relative path. If I have tree structure of web-site I will never get ability to use in error pages files located in some dir in case of different levels where error can occur...

Oh, my slow brains!
Back to top View user's profile Send private message
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Thu Jul 05, 2007 7:49 am    Post subject: Reply with quote

Finally I got result using absolute path.
Let's consider it as IE bug and forget about it.
Sorry for posting stuppid question!
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Jul 05, 2007 4:04 pm    Post subject: Reply with quote

alexey.spb wrote:
Finally I got result using absolute path.
Let's consider it as IE bug and forget about it.
Sorry for posting stuppid question!


That's not an IE bug. For example, say that you have defined a custom error page 404.html which virtual path is /errors/404.html and which contains a link to an image coded as follows:

Code:
<IMG SRC="image.png">


To have this image show correctly, you will have to put a file called image.png inside the directory /errors/.

When you browse http://yoursite/errors/404.html, the browser will read the HTML and find the above IMG tag. Since its SRC parameter refer a relative path, it will locate it relatively to the current directory ( http://yoursite/errors/ ). So it will end up requesting http://yoursite/errors/image.png and the image is found correctly.

Now if you try to see a non-existant page, for example http://yoursite/not/here/page.html , the server will display instead the custom error page. The browser will find the above IMG tag and will try to convert it to an absolute URL using the current directory which is in this case http://yoursite/not/here/ .

So the browser ends up requesting http://yoursite/not/here/image.png and this will cause a problem since there is no such image.

The solution to avoid all that is to NEVER use relative paths when coding error pages. So instead of the above IMG tag, the following is to be used:

Code:
<IMG SRC="/errors/image.png">


With that absolute virtual path, the browser will always request http://yoursite/errors/image.png regardless of the directory or the page where the error occured.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Sat Jul 07, 2007 12:46 pm    Post subject: Reply with quote

Clear.

But I got another issue and I would like to understand what is happening.
I created again error page (let it be 500-error). Then I refused to use it and set no custom error in Abyss config file via console. OK. I thought that Abyss standard error page will be shown at error event. No! The same page appears. I deleted this page from disk, cleared IE cache, checked config of server, and even rebooted computer. Executing the script which leads to the same error I again got the same HTML page! All files included in it were requested from server (according to log file)! It's ridiculous!
I have tryed to re-install Abyss (obviously it shouldn't help) and it was useless.
I suppose that something happend inside windows and it cached some old files but I do not know where.
How I can fight against it???
What does it mean?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jul 07, 2007 2:51 pm    Post subject: Reply with quote

alexey.spb,

Abyss Web Server is not Windows. :-) So reinstalling is not the kind of things that is going to solve your problems. :-)

Are you able to see the error page directly when you browse it (directly)? If the answer is yes, then try using another browser (Opera or Firefox) to see if the customer error page is correctly served.

If on the other browser it is not shown too, please let us know how you have exatcly configured the error page, its virtual path, and its source code.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group