Re: How to customize error responses (while using mod_rewrite)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 May 2017, Eric Covener wrote:

On Mon, May 15, 2017 at 10:46 AM, Jens Schleusener
<Jens.Schleusener@xxxxxxxxxxx> wrote:
Unfortunately for the RewriteRule directive for e.g. a Rewrite flag R=4xx
instead of R=permanent isn't allowed (only 300-399, why?) so I had
considered the usage of the <If> directive but didn't find a working
solution.

Other codes are allowed, but you can't do anything with the
substitution in this case. The reason is that if you return any status
code like this, it short-circuits the processing of the URL by the
rest of the server, so nobody is around to convert the URL to a file
and serve it.

The manual says:
Any valid HTTP response status code may be specified, using the syntax
[R=305], with a 302 status code being used by default if none is
specified. The status code specified need not necessarily be a
redirect (3xx) status code. However, if a status code is outside the
redirect range (300-399) then the substitution string is dropped
entirely, and rewriting is stopped as if the L were used.

Thanks for the clarification. But I am a little bit slow-witted and don't understand what "substitution string is dropped entirely" means. I assume not only the further rewriting rules are skipped but unfortunately also the output of the defined substitution page (/https_tlsv10.html) in

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

(the 412 is here just a placeholder for a really correct response status code) and the Apache httpd outputs "only" the standard page for an 412 error?

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.

Regards

Jens

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux