[fpc-devel] Fcl-Web 404 error

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Fri Mar 11 14:59:23 CET 2011



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.


More information about the fpc-devel mailing list