Advertisement

09.16.2008 at 04:38PM PDT, ID: 23737070
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

Custom error response env variables and rewrite rules

Asked by malklavious in Apache Web Server

Tags: , ,

Greeting Apache experts, I have an interesting question that has perplexed me all day regarding custom error responses, the environment variables they create, and rewrite rules.

I'm using Apache 1.3 working with Tomcat to serve JSP pages.

For the error document directive I have the following entry in my conf file:

ErrorDocument 404 /pageNotFound404.jsp

According to the documentation ( http://httpd.apache.org/docs/1.3/custom-error.html ) Apache should be making some environment variables prefixed with "REDIRECT_".  Specifically I'm looking for the REDIRECT_URL and REDIRECT_QUERY_STRING variables.

I know getting Apache's environment variables into Tomcat isn't a very safe thing to do (and not possible in the environment I'm working on) so I'm trying to handle it via mod_rewrite.  Unfortunately the "REDIRECT_" vars don't seem to be populated at that stage in the request's lifespan.  Here is the rewrite rule I'm using:

RewriteCond %{REQUEST_URI} pageNotFound404.jsp
RewriteRule ^(.*)$ /pageNotFound404.jsp?R_URL=%{REDIRECT_URL}&R_QUERY_STRING=%{REDIRECT_QUERY_STRING} [QSA]

The rule is being processed as I'm getting empty (not null) values for the parameters.  When I look at the QueryString value from the ServletRequest object I get the following:
QueryString: R_URL=&R_QUERY_STRING=

Can anyone give any insight on how to reference these environment variables and/or when they are populated?  I'm not able to use an intermediate cgi script to harvest and forward to the .jsp page so it all needs to be done within this scope.

Thanks!

Start Free Trial
[+][-]09.17.2008 at 11:16AM PDT, ID: 22501877

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Apache Web Server
Tags: custom error, environment variable, rewrite
Sign Up Now!
Solution Provided By: malklavious
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_EXPERT_20070906