--- On Fri, 3/11/11, michael.vancann...@wisa.be <michael.vancann...@wisa.be> wrote:
> From: michael.vancann...@wisa.be <michael.vancann...@wisa.be> > Subject: Re: [fpc-devel] Fcl-Web 404 error > To: "FPC developers' list" <fpc-devel@lists.freepascal.org> > Date: Friday, March 11, 2011, 1:00 PM > > > On Fri, 11 Mar 2011, Leonardo M. Ramé wrote: > > > --- On Fri, 3/11/11, michael.vancann...@wisa.be > <michael.vancann...@wisa.be> > wrote: > > > >> From: michael.vancann...@wisa.be > <michael.vancann...@wisa.be> > >> Subject: Re: [fpc-devel] Fcl-Web 404 error > >> To: "FPC developers' list" <fpc-devel@lists.freepascal.org> > >> Date: Friday, March 11, 2011, 11:59 AM > >> > >> > >> On Fri, 11 Mar 2011, Leonardo M. Ramé wrote: > >> > >> > Hi, does anyone knows how to return a correct > 404 > >> error from an fcl-web cgi app?. > >> > > I'm doing this: > >> > > procedure > TFPWebModule1.myRequest(Sender: TObject; > >> > ARequest: TRequest; AResponse: TResponse; > var > >> Handled: boolean); begin > >> > AResponse.Code := 404; > >> > AResponse.CodeText := 'Not Found'; > >> > Handled := True; > >> > end; > >> > > I use this because my Apache has an > .htaccess's > >> "ErrorDocument 404 ..." > >> > directive to take actions when 404 errors are > found, > >> but this is not > >> > working with my CGI. In my case, the > contents > >> (empty) sent by the CGI are > >> > shown in the client side, while I whould like > to show > >> the 404 message > >> > generated by Apache. > >> > >> Then you should add it to > >> AResponse.Content:='The html'; > >> > >> Michael. > > > > Thanks Michael, but it's a little more complicated > than that. > > > > I need the 404 error to be handled by Apache, not by > my app. I need this because I'm trying to let Apache search > in a 2nd server when an 404 error is returned by the first > server. > > I don't think the CGI protocol supports that. > > You'll have to consult the Apache docs. > > Michael. > -----Inline Attachment Follows----- Nevermind. The solution was to create a file under /var/wwww/cgi-bin called "failoverserver.cfg", containing only one line, for example "192.168.0.10". If the cgi doesn't find a requested record, then, do a AResponse.SendRedirect to the server defined in failoverserver.cfg and the same ARequest.URL. Leonardo. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel