Hi Xavier,

mod_proxy shows a similar behaviour for HTTP error status codes (corrected by https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyerroroverride). 

I believe that when the 403 is generated by fcgi and not by Apache itself then the ErrorDocument is not used to avoid interfering with the response payload. In the mod-proxy case for example you might want to let the backend to return an ad hoc response rather than using Apache's ErrorDocuments, so the "standard" configuration try not to be too invasive (unless explicitly told otherwise by proxyerroroverride). I didn't find any mod_fcgid directive that can help, but you could resolve the issue in two ways:

1) instructing the fcgi application to return the redirect that you want in case of 403/404 
2) using https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html and proxyerroroverride

I might be really wrong so if anybody has a better explanation please correct me :)
It would be also great to update the documentation of mod_fcgid to include a solution to this problem! (/me is going to do it right after the correct answer is given).

Luca



 

2015-12-23 20:06 GMT+01:00 Xavier <x.guimard@free.fr>:
Hi,

When fcgi file returns a 403 error, the error is displayed by Apache
without redirection. When an error is detected on other files (missing
file in static for example), the redirection acts perfectly.

On 23/12/2015 17:06, Luca Toscano wrote:
> Hi Xavier,
>
> what is the exact problem that you are seeing and what are you trying to
> achieve? The two error document directives should issue an HTTP redirect
> (to auth.example.com <http://auth.example.com>) according
> to https://httpd.apache.org/docs/2.4/custom-error.html#configuration,
> but given the port number I guess that it is not probably what you want.
>
> Luca
>
>
> 2015-12-23 8:52 GMT+01:00 Xavier <x.guimard@free.fr
> <mailto:x.guimard@free.fr>>:
>
>     Hi all,
>
>     I'm trying to use ErrorDocument directive with mod_fcgid but it is not
>     interpreted as it works fine for static documents. Here is my
>     virtualhost conf:
>
>     <VirtualHost *:80>
>       ErrorDocument 403 http://auth.example.com:19876/?lmError=403
>       ErrorDocument 404 http://auth.example.com:19876/?lmError=404
>       ServerName manager.example.com <http://manager.example.com>
>       LogLevel debug
>
>       # Redirect REST request to fcgi
>       RewriteEngine on
>       RewriteRule "^/$" "/psgi/manager-server.fcgi" [PT]
>       RewriteCond "%{REQUEST_FILENAME}" "!^/(?:static|doc|fr-doc|lib).*"
>       RewriteRule "^/(.+)$" "/psgi/manager-server.fcgi/$1" [PT]
>
>       Alias /psgi/ /home/xavier/dev/lemonldap/e2e-tests/
>       <Directory /home/xavier/dev/lemonldap/e2e-tests/>
>             SetHandler fcgid-script
>             Options +ExecCGI
>       </Directory>
>       DocumentRoot /home/xavier/dev/lemonldap/lemonldap-ng-manager/site/
>       <Location />
>         Require all granted
>         Options +FollowSymLinks
>       </Location>
>       <Directory
>     /home/xavier/dev/lemonldap/lemonldap-ng-manager/site/static/>
>         Require all granted
>         Options +FollowSymLinks
>       </Directory>
>     </VirtualHost>
>
>     Regards,
>     Xavier
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>     <mailto:users-unsubscribe@httpd.apache.org>
>     For additional commands, e-mail: users-help@httpd.apache.org
>     <mailto:users-help@httpd.apache.org>
>
>

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