Forum Moderators: phranque

Message Too Old, No Replies

customized 403 page won't display pics

         

ihtfp004

6:39 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



I have made a customized 403 page for my apache proxy server. let's call it index.html and that error page uses pics called pic1.gif and pic2.gif. i already have my html set up to point to those images.

the problem is that when i have the error 403 (forbidden) page come up requests to www.cnn.com, it will throw up the error page but none of the images will show up. in the access_log it looks like the server is trying to look for www.cnn.com\pic1.gif and www.cnn.com\pic2.gif.

and also if i block the website www.nba.com, all the text will show up but none of pictures. similar to the above, the access_log shows that it is looking for the pictures from www.nba.com\pic1.gif and www.nba.com\pic2.gif.

so my question is, how come my customized error 403 page won't display pictures from my local machine? and how do i get it to serve up pics in the same directory as my error page?

jdMorgan

7:18 pm on Jul 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have probably blocked images from being served as well as pages. As a result, requests for images will also return a 403-forbidden status. You'll have to allow the images to be served if requested from the error page. Or alternately, keep your error page simple, and omit the images.

Jim

ihtfp004

7:37 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



well right now i'm using the proxyblock* command to block all proxy requests. how could i adjust my server so that things like my pictures don't get blocked?

gergoe

8:05 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



Use fully qualified url for the images, like [domain.com...] so the browser will know from where it needs to be downloaded.

ihtfp004

8:11 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



but the images don't come from a url, they come off from my local machine, actually the same directory where the error page is stored.

so in my error page would i have to point to where the images are, like
<img src="/var/apache/htdocs/pic1.gif">

or since it's in the same directory as the error page can i just be like
<img src="pic1.gif">

i just don't know what to put, to point to the pics physically on my machine.

gergoe

9:12 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



The error page is not a real page actually, it is just a stream of data which the apache uses to send back to the browser upon a 403 error. This means that its url is the one which is forbidden, so it can be anything. Any other file in the directory where the error document file resides is completely ignored, apache will never use it, only if some DocumentRoot directive is set to that directory. So what you have to do is to put those pictures on a website which has an url, and use that url on the error page.

What you can try is use mod_rewrite. Give some weird names to the images (in the html code of the 403 page only!) My403AccessForbidden1stImage.gif for example, and try to set up a rewriting like this:


RewriteRule My403AccessForbidden1stImage\.gif$ var/apache/htdocs/pic1.gif [L]
RewriteRule My403AccessForbidden2ndImage\.gif$ var/apache/htdocs/pic2.gif [L]

It might works (but likelly not, maybe jdMorgan can give you some more hints how to do url to filename mapping on linux)

ihtfp004

2:09 pm on Jul 8, 2004 (gmt 0)

10+ Year Member



here i found something else out.

when i use the statement:

proxyblock www.google.com

and i connect to my proxy server and request www.google.com, the text for my customized 404 comes out, but as i stated earlier the pictures don't come out.

i look on the access log and it shows that www.google.com/pic1.gif and www.google.com/pic2.gif were requested. since all google requests are blocked the pictures aren't coming out on my customized 404.

how can i get my pictures to show up from /var/apache/htdocs/, instead of the requested webite?