You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Henry Noerdlinger <He...@ihsenergy.com> on 2002/10/22 00:36:34 UTC

[users@httpd] CustomError 401 and .htaccess conflict

Hello,

I have tried to find a solution before posting, but I must resort to a 
post. 

I am experiencing some sort of conflict/bug/conf setting problem between 
.htaccess authentication functionality and using a custom 401 error page. 
The problem is specific to 401 (all other customized error pages don't 
impede displaying the password dialogue box).

My problem is that when I add:
ErrorDocument 401 /customerrors/common_401.jsp
to the httpd.conf file, I am no longer prompted for a username/password to 
enter a protected area of our website, instead, the browser is immediately 
directed to the custom 401 error page.

Oddly, if I specify a text string message instead of a local file, the 
username/password dialogue box displayed as expected. So as a workaround, 
I wrote  this in and it worked:
ErrorDocument 401 "<meta http-equiv='refresh' 
content='0;URL=/customerrors/common_401.jsp'>"
But the problem is that I am writing customized messages depending on the 
referer URL. So this workaround won't help me.

We are changing the passwords to a protected area of our website. I want a 
customized error page that will display one set of content depending on 
the referer URL. 

I am running apache 1.3.26 with tomcat 3.2.2 on Solars 2.8

I appreciate any help in this matter.
Henry Noerdlinger
web content developer
IHS Energy

here is a big chunk of the httpd.conf minus comments:
ServerType standalone
ServerRoot "/usr/local/ihse/apache"
PidFile logs/httpd.pid
ScoreBoardFile logs/httpd.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
Listen 80

LoadModule vhost_alias_module libexec/mod_vhost_alias.so
LoadModule env_module         libexec/mod_env.so
LoadModule config_log_module  libexec/mod_log_config.so
#many other modules are here - abbreviated for usenet posting


LoadModule setenvif_module    libexec/mod_setenvif.so
ClearModuleList
AddModule mod_vhost_alias.c
AddModule mod_env.c
#many other modules are here - abbreviated for usenet posting

Port 80
User internetaccount
Group igroup
ServerAdmin sys.admin@ihs.com
ServerName arnold.ihsenergy.com

DocumentRoot "/usr/local/ihse/apache/htdocs"

<Directory />
    Options None
    AllowOverride All
    Order Deny,Allow
    Deny from all
</Directory>

<Directory "/usr/local/ihse/apache/htdocs">
    AllowOverride FileInfo AuthConfig Limit 
    Options Indexes FollowSymLinks MultiViews
    Order allow,deny
    Allow from all
</Directory>

<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>

<IfModule mod_dir.c>
    DirectoryIndex index.html
</IfModule>

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

UseCanonicalName On

<IfModule mod_mime.c>
    TypesConfig conf/mime.types
</IfModule>

DefaultType text/plain

<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>

HostnameLookups Off

ErrorLog logs/error_log

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" 
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

CustomLog logs/access_log common

ServerSignature On
<IfModule mod_alias.c>
    Alias /icons/ "/usr/local/ihse/apache/icons/"
    <Directory "/usr/local/ihse/apache/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    Alias /manual/ "/usr/local/ihse/apache/htdocs/manual/"

    <Directory "/usr/local/ihse/apache/htdocs/manual">
        Options Indexes FollowSymlinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    ScriptAlias /cgi-bin/ "/usr/local/ihse/apache/cgi-bin/"

    <Directory "/usr/local/ihse/apache/cgi-bin">
        AllowOverride None
        Options ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>

<IfModule mod_autoindex.c>
    IndexOptions FancyIndexing
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    #may more AddIcon stuff here deleted for brevity for posting
    DefaultIcon /icons/unknown.gif
    ReadmeName README
    HeaderName HEADER
</IfModule>

Alias /customerrors /usr/local/ihse/apache/htdocs/customerrors
<Directory /usr/local/ihse/apache/htdocs/customerrors>
        Options FollowSymLinks
        AllowOverride AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
</Directory>
ErrorDocument 401 /customerrors/common_401.jsp


Include /usr/local/ihse/jakarta-tomcat-3.2.2/conf/mod_jk.conf-auto

Re: [users@httpd] CustomError 401 and .htaccess conflict

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 21 Oct 2002, Henry Noerdlinger wrote:
> My problem is that when I add:
> ErrorDocument 401 /customerrors/common_401.jsp
> to the httpd.conf file, I am no longer prompted for a username/password
> to enter a protected area of our website, instead, the browser is
> immediately directed to the custom 401 error page.

In order to prompt for a password, the browser must receive the 401 status
code as part of the 401 error doc.  Your jsp page is probably not sending
the correct Status: line.

Joshua.


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org