Re: how to make ErrorDocument apply to https:// site as well?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 07:38 PM 7/24/2010, Bennett Haselton wrote:
In my httpd.conf file I added the directive (at the bottom of the file, so at the top level):

ErrorDocument 403 /banned_ip.php

That works when I go to a file that I've set chmod to 000:
http://209.160.28.154/forbidden.txt

(of course the "banned IP" message doesn't make any sense in that context where the real reason the file is forbidden is because its permissions are 000, but I'm just testing the ErrorDocument directive)

But when I go to the https:// version of the same URL (after ignoring the SSL cert error of course):
https://209.160.28.154/forbidden.txt
I see a generic "403 forbidden" instead of the error I specified in ErrorDocument.

A little more potentially useful information:
The 403 forbidden message that comes up when I try to access an https:// URL also says: "Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."

So apparently Apache is *applying* the ErrorDocument directive to https:// requests, it's just not able to find the /banned_ip.php file when doing so.

So since my directive says
ErrorDocument 403 /banned_ip.php
how come Apache can find that file when giving a 403 error in response to an https request, but not in response to an http request?

Presumably for http requests, Apache understands that "/banned_ip.php" refers to the file "/var/www/html/banned_ip.php" because of the
DocumentRoot "/var/www/html"
line in httpd.conf.

However, this is supposed to be inherited to the SSL host as well -- ssl.conf has these lines in the middle:

<VirtualHost _default_:443>

# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
#ServerName www.example.com:443


... etc. (And I tried uncommenting that "DocumentRoot" line in ssl.conf to see if that fixed it, but that didn't work either.)

So why doesn't it work? The DocumentRoot directive is supposed to be inherited to the SSL server, and with that inherited, it should understand that "ErrorDocument 403 /banned_ip.php" refers to /var/www/html/banned_ip.php , shouldn't it?

-Bennett

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux