You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sean Conner <sp...@conman.org> on 2006/11/10 03:43:04 UTC

[users@httpd] Custom 500 error page

  I'm in the process of moving a website, and while moving it, I would like
to serve out a response code of 503 (out of service), which I can accomplish
with a simple:

	Redirect 503 /

  *But* I want to send out a custom error response.  But when I do this (see
below for full configuration for this site):

	ErrorDocument	503	/errors/503.shtml
	Redirect	503	/

  I get the following when going to the website:

	Service Temporarily Unavailable

	The server is temporarily unable to service your request due to
	maintenance downtime or capacity problems. Please try again later.

	Additionally, a 503 Service Temporarily Unavailable error was
	encountered while trying to use an ErrorDocument to handle the
	request.  Apache/2.0.55 (Unix) DAV/2 Server at wiki.flummux.org Port
	80

  How can I go about getting a custom 503 response?

  -spc (Very puzzled by this ... )

<VirtualHost 66.252.227.139>
  ServerName    wiki.flummux.org
  ServerAdmin   sean@conman.org
  DocumentRoot  /home/spc/wiki/htdocs
  CustomLog     logs/wiki.flummux.org combined

  ErrorDocument   400     /errors/400.shtml
  ErrorDocument   401     /errors/401.shtml
  ErrorDocument   402     /errors/402.shtml
  ErrorDocument   403     /errors/403.shtml
  ErrorDocument   404     /errors/404.shtml
  ErrorDocument   405     /errors/405.shtml
  ErrorDocument   406     /errors/406.shtml
  ErrorDocument   407     /errors/407.shtml
  ErrorDocument   408     /errors/408.shtml
  ErrorDocument   409     /errors/409.shtml
  ErrorDocument   410     /errors/410.shtml
  ErrorDocument   411     /errors/411.shtml
  ErrorDocument   412     /errors/412.shtml
  ErrorDocument   413     /errors/413.shtml
  ErrorDocument   414     /errors/414.shtml
  ErrorDocument   415     /errors/415.shtml
  ErrorDocument   416     /errors/416.shtml
  ErrorDocument   417     /errors/417.shtml
  ErrorDocument   500     /errors/500.shtml
  ErrorDocument   501     /errors/501.shtml
  ErrorDocument   502     /errors/502.shtml
  ErrorDocument   503     /errors/503.shtml
  ErrorDocument   504     /errors/504.shtml
  ErrorDocument   505     /errors/505.shtml

  <Directory /home/spc/wiki/htdocs>
    AllowOverride       All
    Options             All

    AuthType            Basic
    AuthName            "Wiki Editing"
    AuthUserFile        /home/spc/blog/users
    AuthGroupfile       /home/spc/blog/groups

    Redirect	503	/

    <LimitExcept GET HEAD>
      Require   valid-user
    </LimitExcept>
  </Directory>

# I might be doing this wrong
#
#  <LocationMatch "/!(errors).*">
#    Redirect	503	/
#  </LocationMatch>

# Ignore this---this works, but I didn't want it
# to interfear with the above LocationMatch, so
# it's commented out prior to me mucking with this.
#
#  <Location "/edit/">
#    Require valid-user
#  </Location>

  <Directory /home/spc/wiki/htdocs/private>
    AllowOverride       All
    Options             All

    AuthType            Basic
    AuthName            Administration
    AuthUserFile        /home/spc/wiki/users
    AuthGroupFile       /home/spc/wiki/groups
    Require             group admin

  </Directory>

</VirtualHost>


---------------------------------------------------------------------
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


Re: [users@httpd] Custom 500 error page

Posted by Sean Conner <sp...@conman.org>.
It was thus said that the Great Ricky Zhou once stated:
> 
> Sean Conner wrote:
> > 
> > 	ErrorDocument	503	/errors/503.shtml
> > 	Redirect	503	/
> > 
> When you made everything return a 503, that included the error page,
> hence the additional 503 error.  I'm not sure if this is the
> best/recommended way, but if you use a RedirectMatch to match everything
> but /errors/503.shtml, the error page will work.

  I attempted to do that, but my regex skills apparently weren't up to the
task (that attempt was commented out in the configuration I sent).

  -spc (Well, I tried to match anything under the /errors subdirectory
	but ... )




---------------------------------------------------------------------
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


Re: [users@httpd] Custom 500 error page

Posted by Ricky Zhou <ri...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sean Conner wrote:
> 
> 	ErrorDocument	503	/errors/503.shtml
> 	Redirect	503	/
> 
When you made everything return a 503, that included the error page,
hence the additional 503 error.  I'm not sure if this is the
best/recommended way, but if you use a RedirectMatch to match everything
but /errors/503.shtml, the error page will work.

Hope this helps,
Ricky
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFU+xNiXbZ7NjlUcARAlcKAKCvZG9Cz4TrnxkCYU8OfcdBp0Qh9ACcD0al
kwLThnY2r2MV+f0PznskNNQ=
=djeM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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