httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Schleusener" <Jens.Schleuse...@t-online.de>
Subject [users@httpd] Re: How to customize error responses (while using mod_rewrite)?
Date Tue, 16 May 2017 14:54:12 GMT
On Mon, 15 May 2017, Jens Schleusener wrote:

> On Mon, 15 May 2017, Eric Covener wrote:
>
>> On Mon, May 15, 2017 at 12:32 PM, Jens Schleusener
>> <Jens.Schleusener@t-online.de> wrote:
>>> Ok, in that case one could use the ErrorDocument directive (it works for 
>>> me
>>> principally) but how can one can achieve that that directive is not used
>>> globally but only specific for the above case?
>>> 
>>> The idea to set in the above RewriteRule additionally an environment
>>> variable for e.g. via a "E=tlsv10:1" flag and using
>>>
>>>   <If "env('tlsv10') -eq 1">
>>>     ErrorDocument 412 /https_tlsv10.html
>>>   </If>
>>> 
>>> seems not to work, the Apache httpd outputs the "412" standard error
>>> message.
>> 
>> Re: the If misfiring, its because <if is evaluated shortly before
>> RewriteRule. You can check SSL envvars directly, or use setenvif
>> instead of RewiteRule to set the envvar.
>
> Thanks for the hint, I will try it.

With your hint and some testing I ended up now with the following by 
choosing for now the response error status code 412 ("Precondition 
Failed"):

  <If "%{SSL_PROTOCOL} == 'TLSv1'">
   ErrorDocument 412 /https_tlsv10.html
  </If>

  RewriteCond %{SSL:SSL_PROTOCOL} ^TLSv1$
  RewriteRule !^/https_tlsv10.html$ - [R=412,L]

So my special example problem seems to be solved but the original general 
question how one can generate customized error responses while using the 
mod_rewrite module seems to have as general answer only the use of an
appropriate CGI program.

Thanks for the help

Jens

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message