Question about Hiawatha error page.

Using applications, configuring, problems
Post Reply
Message
Author
Pupnovice
Posts: 15
Joined: Sat 19 Apr 2008, 15:16

Question about Hiawatha error page.

#1 Post by Pupnovice »

Hi folks,

I wonder if any of you have used or currently use Hiawatha for serving web-pages?

Hiawatha has been running here on an old PC with puppy-linux for over 6 months now and aside from a few minor problems at the start it has performed very well.

Question:
This may seem a silly question but I noticed that when I enter an incorrect URL the local server/Hiawatha returns a "404" error page. Thats OK and I never questioned it before but more recently I noticed in the hiawatha.conf file that all the lines relating to error handling seem to be commented-out by default. That is to say that error handling does not appear to be enabled yet I still get an error page when an error happens so where do these pages come from?

The reason I ask is because I have read the support information for hiawatha which explains to some degree how to implement user generated error pages using (I think) cgi scrips but is it possible to alter the existing default error messages generated by hiawatha and where do they come from in the first place?

BTW I recently installed Hiawatha on a raspberry-pi and it runs quite happily as a small, snappy wireless-server. But, it also has all the error handling lines commented-out in the hiawatha.conf file and still manages to produce an error page when required, can anyone shed any light on this please?

Regards to all,

pupnovice.

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#2 Post by npierce »

Pupnovice wrote:. . . error handling does not appear to be enabled yet I still get an error page when an error happens so where do these pages come from?
Even if you have no ErrorHandler line in your configuration file, errors will still be handled. That line is just for using a custom error page; without it a default error page is used.

These default error pages don't live anywhere, but are created internally by hiawatha when an error is encountered.
Pupnovice wrote:. . . is it possible to alter the existing default error messages generated by hiawatha and where do they come from in the first place?
Since they are created by the hiawatha server itself, you could certainly modify hiawatha and recompile it, but it is a lot easier just to use the ErrorHandler line in the configuration file.

Even though the error page doesn't exist as a file anywhere, there is nothing to stop you from using your browser's Menu -> Save Page As... to save it to your /root/Web-Server/ directory (or whatever directory you are using for you WebsiteRoot). Then you can modify it to your liking.

Then add an "ErrorHandler" line to the configuration for your host and/or the appropriate virtual host in your configuration file. For instance, if your customized error page is for error 404, and you have named it "error_404.html", you would add this line:

Code: Select all

ErrorHandler = 404:/error_404.html
(You will, of course, need to restart hiawatha for that line to take effect.)

Pupnovice
Posts: 15
Joined: Sat 19 Apr 2008, 15:16

#3 Post by Pupnovice »

Hi npierce,

Just a few lines to say thanks for responding to my earlier question about Hiawatha.

I would never have thought of saving/editing the system generated error page in that way, cool!

It worked a treat. I was also pleased to learn that the user generated custom error page can be straight html. The Hiawatha help pages are not clear on that subject or perhaps its just me ;-) I had been labouring under the misconception that the error page had to be a cgi/php or some other script.

In any event, it all works fine now and much better to see a custom error page saying something other than "404 page not found" or whatever. I am thinking "DOH!" might be more appropriate :-)

Thanks again and best wishes,

pupnovice.

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#4 Post by npierce »

You're welcome.

Glad it worked.

Post Reply