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 12:32 PM, Jens Schleusener
<Jens.Schleusener@xxxxxxxxxxx> 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.

But Is it much better than a redirect or rewrite to some document that
describes the problem but has a 200 status code?

That is a great question that I cannot answer it (you had tried it indirectly).

It becomes a little bit off-topic but an answer to this question would very important to me since I provide an FOSS offering server with more or less frequently changing releases so that the server tries to redirect normally failing accesses to URLs according to no longer available releases to "guessed" URLs of the corresponding current release. If the server does that transparently responding with a 200 status code a human client may get not really the resource he has requested although he may have the impression and additionally search engines may index resources that are not 100% related to the accessed URLs. Also a status code 301 would be in this sense wrong since it implies the same problem.

So currently the server answers with a 404 ("Not Found") but with an informative error page containing links to the new resources. Probably appropriate for human users but bad for search engines that get a lot of error responses (probably not regarding the contents of the error page).

I would be happy about a status code like 310 (a merge of 301 and 410) saying "Resource is no longer available but here is its successor" ;-)

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