Mar 04 2008

Apache ErrorDocument 跳转到 jsp后没有 REDIRECT_URL header

Category: 技术ssmax @ 17:10:23

嗅嗅今天发了个问题,apache REDIRECT_URL not set

  <LocationMatch “/web/.*\.html”>
        Options FollowSymLinks Includes
        AllowOverride None
        ErrorDocument 404 /detail.jsp

 在jsp里面拿不到  REDIRECT_URL 头


Additional functionality. Allows webmasters to configure the response of Apache to some error or problem.Customizable responses can be defined to be activated in the event of a server detected error or problem.

e.g. if a script crashes and produces a “500 Server Error” response, then this response can be replaced with either some friendlier text or by a redirection to another URL (local or external).

Old behavior
NCSA httpd 1.3 would return some boring old error/problem message which would often be meaningless to the user, and would provide no means of logging the symptoms which caused it.
New behavior
The server can be asked to;

  1. Display some other text, instead of the NCSA hard coded messages, or
  2. redirect to a local URL, or
  3. redirect to an external URL.

Redirecting to another URL can be useful, but only if some information can be passed which can then be used to explain and/or log the error/problem more clearly.

To achieve this, Apache will define new CGI-like environment variables, e.g.

REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg
REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712)

note the REDIRECT_ prefix.

At least REDIRECT_URL and REDIRECT_QUERY_STRING will be passed to the new URL (assuming it’s a cgi-script or a cgi-include). The other variables will exist only if they existed prior to the error/problem. None of these will be set if your ErrorDocument is an external redirect (i.e., anything starting with a scheme name like http:, even if it refers to the same host as the server).


3.0.18 – Feb 23, 2006

  • ConnectionPool needs to be a lifo to avoid accumulating too many pool items (rep b Kaminsky Leonid)
  • max-create-connections wasn’t included in DBPool (rep by Kaminsky Leonid)
  • (2006-02-15) mod_caucho was not properly handling check-interval larger than 32-bits (#926, rep by Mutsubu Inayama)
  • Changes in ./configure and Makefile for MacOSX EGREP libtool issue (#432, rep by jdane)
  • (2006-02-09) class-loader can now appear anywhere, not just first element (#924, rep by dlcr)
  • Amber inheritance needs to work with CMR (#301, rep by Francois Bertrand)
  • JMX Notifications on restart (#195, #237, rep by Erik Hartenian, Glenn Rush)
  • fmt:param wasn’t printing children for validation (#893, rep by Ed Hollingsworth)
  • Apache2 mod_caucho needs to grab REDIRECT_URL and REDIRECT_QUERY_STRING (#87, rep by A Jacklin)
  • change escaping of command line argument for WIN32 service installation (#141, rep by Steve Arbour)
  • 哈哈,就这样解决了,升级吧。。。。