Toolserver:ZWS

ZWS or Zeus Web Server is the web server the Toolserver has been using since 2008-12-02. ZWS replaced Apache and switchboard and supports most of the functionality of Apache, including .htaccess.

.htaccess
Redirect 301 /~jsmith/links.html /~example/view/Links
 * 1) Permanently redirect from the old address

Redirect 302 /~jsmith/tool_lastest.fcgi /~example/tool_132.fcgi
 * 1) Temporarily redirect

Redirect 410 /~jsmith/tool_broken.fcgi
 * 1) Gone, tell searching engines and spider to remove

Content-Type
Server files with a file extension of  with a UTF-8 character encoding AddType text/plain;charset=UTF-8 txt

Change the default type from  to include a character encoding: DefaultType text/plain;charset=UTF-8

rewrite.script
However, it doesn't support rewriterules (i.e. the RewriteRule directive). Fortunately, equivalent functionality is supported in a different form. To use rewrites with ZWS, you need to create a rewrite script. Some documentation on this is available here:


 * http://support.zeus.com/zws/examples/2005/12/16/converting_apache_rules_to_zws
 * http://support.zeus.com/zws/examples
 * http://support.zeus.com/zws/media/docs/4.3/ZWSUserGuide.pdf (section 8.7)

Your rewrite script should be placed in $HOME/rewrite.script. Unlike Apache rewrite rules, there is only one script for your entire public_html, not one per directory.

Converting rewriterules
If your rewrite rules are fairly simple, you can convert them using the convert_rewrite utility on wolfsbane:

$ /opt/zeus/webadmin/bin/convert_rewrite $HOME/public_html/.htaccess >$HOME/rewrite.script

You will want to inspect the script after running this to make sure it does what you want. In particular, you might find that if you used this kind of rewrite rule:

RewriteBase /~jsmith RewriteRule ^mytool$ /some/other/path

Then the URLs in the generated rewrite.script will look like this: match URL into $ with ^mytool$

However, this URL is wrong; the converter did not convert the RewriteBase. You will need to edit the script to look like this:

match URL into $ with ^/~jsmith/mytool$

Apart from this, the rewrite scripts that convert_rewrite generates are somewhat convoluted, so you might want to clean them up by hand.

Note: Redirect directive are still kept in the .htaccess files

Redirection
For many use cases, you will want to tell a client that has requested some resource to instead request some other resource with a 301 (permanent) or 302 (temporary) redirect. match URL into $ with ^/~jsmith(/docs/?)?$ if matched then set URL            = /~example/docs/home set RESPONSE       = 301 set OUT:Location   = %{URL} set BODY           = Please try here instead.\n endif This solves the problem of relative URLs pointing to the wrong location when using the rewrite mechanism below.
 * 1) Redirect /~jsmith/ to /~jsmith/docs/


 * Caution If /~jsmith/ 301 redirected to /~jsmith/docs/first_tool and it was changed to /~jsmith/docs/home, all services that had previously accessed the old URL continue to pointed to /~jsmith/docs/first_tool as the correct address

Hiding internals
This method rewrites the client request internal to the web server. match URL into $ with ^/~jsmith/docs/(.+) if matched then set URL            = /~jsmith/cgi-bin/docs.pl?$1 goto END endif Using this method of internal rewriting may not be what you want - check if applies to your situation.

match URL into $ with ^/~jsmith/(cache|edit|list|report|source|summary|view)/([^?]+)\??(.*) if matched set URL = /~jsmith/cgi-bin/viewer.py/$2?action=$1&$3 endif We've changed the program a little, it will use PATH_INFO part (viewer.py/PAGE) since it keeps the characters  but for it we give up   without encoding it as %3F. And we allow additional parameter to be pass with the original URL after.
 * 1) Hide internals of viewer.py
 * 2) General form: /~user/action/page [ ?additional=CGI parameters ]
 * Notes

Loops
Zeus keeps a count of the commands run if it exceeds an internal threshold it will return a five hundred server error.

The following code will decode ?, &, and =</tt> characters which allows tools to be linked with (e.g. ~example/cgi-bin/tool.php?user=example).

match URL into $ with ^/~dispenser/cgi-bin/([^"%+;=?]+)%3[Ff](.+)$ if not matched then goto RULE_1_END   set URL = /~dispenser/cgi-bin/$1?$2
 * 1) Makes  linking possible for cgi scripts

AMPERSANDLOOP: match URL into % with ^(.*)%26(.*)$ if not matched then goto LOOPEND_A set URL = %1&%2 goto AMPERSANDLOOP LOOPEND_A:

EQUALLOOP: match URL into % with ^(.*)%3[Dd](.*)$ if not matched then goto LOOPEND_E set URL = %1=%2 goto EQUALLOOP LOOPEND_E:

set RESPONSE = 301 # Use a 301 (permanent) redirect set OUT:Location = %{URL} set BODY = Please try <a href="%{URL}">here</a> instead\n goto END RULE_1_END: