Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Set HTTP Status code

by quester (Vicar)
on Nov 16, 2011 at 06:30 UTC ( #938319=note: print w/replies, xml ) Need Help??

in reply to Set HTTP Status code

First check the HTTP server's access and error logs. There will probably be a message in the error log saying that was not found, but you may find a more specific reason. If not, you will have to figure out why the server can't find (or can't open) the script.

There are several possibilities. First, check that the URL you use really corresponds to the directory where the script is. Commonly, a script would be in a cgi-bin directory and the URL needs to end in .../cgi-bin/

Another possibility is that is not executable by the HTTP server; an ls -l will show you if the appropriate execute bits are missing, or if the file ownership isn't what you expected.

Replies are listed 'Best First'.
Re^2: Set HTTP Status code
by molybtek (Novice) on Nov 16, 2011 at 22:39 UTC

    We are using Apache 2.2 web server.

    The server does find the code and is executing it - if I removed the code to change the status, it will display the output from the program, and the status is 200 OK.

    However, I want it to display a status of 404 Not Found, so when I included the code $self->header_props(-status => 404);, I get the error message instead of the output from the program.

    I've checked the error log, there are no entry for it.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://938319]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2022-05-16 10:01 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (62 votes). Check out past polls.