Hiawatha gurus, I need your help with URLToolkit

Using applications, configuring, problems
Post Reply
Message
Author
jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

Hiawatha gurus, I need your help with URLToolkit

#1 Post by jafadmin »

I have a simple, LAN only, HTML, hiawatha site running on a puppy in /root/Web-Server with a "index.html" file.

I'm trying to make URLTool fix URL's that don't match the site. (goofy clicks in favorites, etc.) My hiawatha.conf file:

Code: Select all

ServerId = webuser
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log

UrlToolkit {
	ToolkitID = my_rewrite
	RequestURI exists Return
	Match .* Rewrite /index.html
}

Binding {
	Port = 80
	Interface = 172.28.226.1
}

Hostname = 127.0.0.1
WebsiteRoot = /root/Web-Server
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log

VirtualHost {
  Hostname = localhost
  WebsiteRoot = /root/Web-Server
  StartFile = index.html
  AccessLogfile = /var/log/hiawatha/access.log
  ErrorLogfile = /var/log/hiawatha/error.log
  UseToolkit = my_rewrite
}
#add this stuff to get a perl script working (pplog)...
#QUISP has a binary executable CGI named 'quisp.bin'...
MimetypeConfig = /etc/mime.types
#CGIhandler = /usr/bin/perl:pl
CGIextension = pl,bin
ExecuteCGI = yes
#QUISP puts %0D, %0A (carriage-return, line-feed) chars in the url
#(v128), to allow chars below ascii 32 need this...
SecureURL = no
This is on Precise 5.71 .. Anyway, the "UseToolkit = my_rewrite" isn't changing the urls to the index.html ..

Any insights would be greatly appreciated. :(

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#2 Post by rockedge »

what version of Hiawatha are you running? I assume its around version 6.17.1.

have you tried using wigwam with the -t switch? this tests URL's you can input and see what the rewrite of the tookkit will look like.

Code: Select all

wigwam -t my_rewrite
manual -> https://www.hiawatha-webserver.org/manpages/wigwam

tests with your hiawatha.conf are below
Attachments
wigwam-tests.png
(27.77 KiB) Downloaded 87 times

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#3 Post by jafadmin »

It gives me the following. The problem is that if I type a url in the browser window, it works fine, but if I select a saved link from favorites, it hangs and doesn't serve the content properly.

I = Stumped.

Probably has to do with that "Bad URL" message, right?
Attachments
screen.png
(21.03 KiB) Downloaded 23 times

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#4 Post by trapster »

try:

Match /(.*) Rewrite /index.html

?
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#5 Post by jafadmin »

trapster wrote:try:

Match /(.*) Rewrite /index.html

?
No Joy .. Actually made it worse ..

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#6 Post by jafadmin »

Ok, I think it messes up when the url has "https" instead of "http"

Any ideas how to fix that?

thx

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#7 Post by trapster »

From the Hiawatha web sight
UseSSL is for https
?


The complete syntax of the URL toolkit in Hiawatha is:


UrlToolkit {
ToolkitID = <toolkit_id>

Call <rewrite_id>
Header <key> [!]<value> Call|DenyAccess|Exit|Goto|Return|Skip|Use
Match [!]<url> Ban|Call|DenyAccess|Exit|Expire|Goto|Return|Rewrite|Redirect|Skip|UseFastCGI
Method [!]<request method> Call|DenyAccess|Exit|Goto|Redirect|Return|Skip|Use
RequestURI exists|isfile|isdir Return|Exit
Skip <lines>
UseSSL Call|Exit|Goto|Return|Skip
}


The format of the actions is as follows:

Ban <seconds>
Call <toolkit_id>
DenyAccess
Exit
Expire <number> (seconds|minutes|hours|days|weeks|months) [Public|Private] [Return|Exit]
Goto <toolkit_id>
Redirect <url>
Return
Rewrite <replace> [<max_loop>] [Continue|Return]
Skip <lines>
Use <url>
UseFastCGI <fastcgi_server_id>

Explanation of the commands:

Ban: Ban the client for <seconds> seconds.
Call: Execute another rule and proceed with the current rule afterwards.
DenyAccess: Denies access to the requested file (results in a 403 error) and terminate toolkit processing.
Exit: Stop URL rewriting.
Expire: Adds an Expires HTTP header with current timestamp + <time>. The default behaviour is to continue after an Expire action.
Goto: Execute another rule and terminate toolkit processing.
Match: Perform the following action if <url> matches the requested URL.
Method: Perform an action for a certain request method.
Redirect: Redirect the browser to <url> via a 301 and terminate toolkit processing.
RequestURI: Check if the requested URL is a file or a directory.
Rewrite: Rewrite the current URL for maximum <max_loop> times (default=1) and terminate toolkit processing.
Return: Return from the current rewrite rule.
Skip: Skip the following <number> of lines (ToolkitID excluded).
ToolkitID: Assign a label to the current rule set.
Use: Replace the current URL with a new one.
UseFastCGI: Use FastCGI server with id <fastcgi_server_id> and terminate toolkit processing.
UseSSL: Perform action when client is connected via HTTPS.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

Post Reply