You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Xavier <x....@free.fr> on 2015/12/23 08:52:33 UTC

[users@httpd] ErrorDocument not read with fcgid

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
  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
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ErrorDocument not read with fcgid

Posted by "Rose, John B" <jb...@utk.edu>.
You may want to look at ...

ProxyErrorOverride On


Sent from my iPad

> On Dec 24, 2015, at 11:17 AM, Xavier <x....@free.fr> wrote:
> 
>> On 24/12/2015 14:12, Luca Toscano wrote:
>> 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
> 
> Thanks Luca,
> 
> (it's for LemonLDAP::NG project). Using the first case, Apache logs may
> store a bad information since we'd like to keep 403 in logs. I will
> propose to the project community to produce a 403 page containing a
> little javascript to redirect, so we'll keep logs and be compatible with
> all FastCGI servers.
> 
> Merry Christmas !!
> 
>> 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
>> <ma...@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>
>>    <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 <ma...@free.fr>
>>> <mailto:x.guimard@free.fr <ma...@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>
>>    <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
>>    <ma...@httpd.apache.org>
>>>    <mailto:users-unsubscribe@httpd.apache.org
>>    <ma...@httpd.apache.org>>
>>>    For additional commands, e-mail: users-help@httpd.apache.org <ma...@httpd.apache.org>
>>>    <mailto:users-help@httpd.apache.org
>>    <ma...@httpd.apache.org>>
>> 
>>    ---------------------------------------------------------------------
>>    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>    <ma...@httpd.apache.org>
>>    For additional commands, e-mail: users-help@httpd.apache.org
>>    <ma...@httpd.apache.org>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

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


Re: [users@httpd] ErrorDocument not read with fcgid

Posted by Xavier <x....@free.fr>.
On 24/12/2015 14:12, Luca Toscano wrote:
> 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

Thanks Luca,

(it's for LemonLDAP::NG project). Using the first case, Apache logs may
store a bad information since we'd like to keep 403 in logs. I will
propose to the project community to produce a 403 page containing a
little javascript to redirect, so we'll keep logs and be compatible with
all FastCGI servers.

Merry Christmas !!

> 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
> <ma...@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>
>     <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 <ma...@free.fr>
>     > <mailto:x.guimard@free.fr <ma...@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>
>     <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
>     <ma...@httpd.apache.org>
>     >     <mailto:users-unsubscribe@httpd.apache.org
>     <ma...@httpd.apache.org>>
>     >     For additional commands, e-mail: users-help@httpd.apache.org <ma...@httpd.apache.org>
>     >     <mailto:users-help@httpd.apache.org
>     <ma...@httpd.apache.org>>
>     >
>     >
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>     <ma...@httpd.apache.org>
>     For additional commands, e-mail: users-help@httpd.apache.org
>     <ma...@httpd.apache.org>
> 
> 

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


Re: [users@httpd] ErrorDocument not read with fcgid

Posted by Luca Toscano <to...@gmail.com>.
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....@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
> > <ma...@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
> >     <ma...@httpd.apache.org>
> >     For additional commands, e-mail: users-help@httpd.apache.org
> >     <ma...@httpd.apache.org>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] ErrorDocument not read with fcgid

Posted by Xavier <x....@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
> <ma...@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
>     <ma...@httpd.apache.org>
>     For additional commands, e-mail: users-help@httpd.apache.org
>     <ma...@httpd.apache.org>
> 
> 

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


Re: [users@httpd] ErrorDocument not read with fcgid

Posted by Luca Toscano <to...@gmail.com>.
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) 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....@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
>   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
> For additional commands, e-mail: users-help@httpd.apache.org
>
>