Tom,

I really appreciate your help with this.

Here is my solution. It seems to work so far.

I altered the code in rewriteurl.tcl to the following:

----------------

ns_log Notice "tcl/rewriteurl.tcl: loading test rewrite filters..."

proc rewriteRequest { why } {

    set url [ns_conn url]
    ns_log Notice "rewriteRequest: starturl: '$url'"

    set host [string tolower [ns_set iget [ns_conn headers] host]]

if {[string equal [string tolower [string range $host 0 3]] "www."]} {
        set host [string range $host 4 end]
    }

    if {![string match "" $host]} {
        set new_url "/${host}$url"
        ns_rewriteurl $new_url
        ns_log Notice "rewriteRequest: newurl: '$new_url'"
    }
    return filter_ok
}


proc finalURL { why } {

    ns_log Notice "finalURL: URL: '[ns_conn url]'"
    return filter_ok
}


# Fire rewriteRequest on every request
ns_register_filter preauth GET /* rewriteRequest

# show final URL in trace filter
ns_register_filter trace GET /* finalURL


ns_log Notice "tcl/rewriteurl.tcl: finished loading test rewrite filters."

-----------------


This simply handled the question regarding the www. in the rewriteRequest proc and eliminated the filter that would have called the rewriteWWW proc.

Do you see any issues with this approach? Any issues with using this as a means to run virtual hosts on a moderately busy server?

Thanks again.

Best regards

Thorpe



On Feb 27, 2007, at 4:00 PM, Tom Jackson wrote:

Thorpe,

Also, if you continue to have problems, please append this script to your startup, or run from a tcl/adp page to post your config. It is so easy to think things are set one way, and it is impossible to know for sure unless
you look:

# Place this at the end of the startup script (the very very end):
#
# Write Config if Errors Exist
#
set ErrorText "debug"
set ErrorFile /tmp/aolerrors.txt

if {![string eq "" "$ErrorText"]} {
    set configDebug 1
}

if {[info exists configDebug] && $configDebug} {

    set sections [ns_configsections]

    set output [list]

    foreach section $sections {
        set name [ns_set name $section]
        set section_txt ""
        append section_txt "ns_section $name\n"

        set size [ns_set size $section]
        for {set i 0} {$i < $size} {incr i} {
append section_txt "\t[list ns_param [ns_set key $section $i]
[ns_set value $section $i]]\n"
        }
        lappend output $section_txt

    }
    set output "[join [lsort $output] "\n"]\n"
    puts "\n$output\n"
}


if {![string eq "" "$ErrorText"]} {
    set ErrorFd [open $ErrorFile w+]
    puts $ErrorFd $ErrorText
    puts $ErrorFd $output
    close $ErrorFd

}

### Finished #######


Hope you get this setup without too much trouble.

tom jackson


On Tuesday 27 February 2007 12:32, Thorpe Mayes wrote:
I am trying to install nsrewrite aolserver module and use it in the virtual
hosting module per Tom Jackson
(http://rmadilo.com/files/nsrewrite/doc/nsrewriteurl.html) .

I downloaded the nsrewrite files and did the install. Here is the result of
the install:

make install
/usr/local/bin/tclsh8.4 /usr/local/aolserver/bin/nsinstall.tcl -d
/usr/local/aolserver/bin -e nsrewrite.so
installed: /usr/local/aolserver/bin/nsrewrite.so (0755)
/usr/local/bin/tclsh8.4 /usr/local/aolserver/bin/nsinstall.tcl -d
/usr/local/aolserver/lib -e libnsrewrite.so
installed: /usr/local/aolserver/lib/libnsrewrite.so (0755)
/usr/local/bin/tclsh8.4 /usr/local/aolserver/bin/nsinstall.tcl -d
/usr/local/aolserver/lib libnsrewrite.a
installed: /usr/local/aolserver/lib/libnsrewrite.a (0644)
ranlib /usr/local/aolserver/lib/libnsrewrite.a


Looks like it installed okay.

I then put the rewriteurl.tcl file in /usr/local/aolserver/modules/tcl.

I restarted aolserver - and it restated - and it looks like the rewriteurl
filters loaded as well:

[27/Feb/2007:14:03:27][30188.3084097216][-main-] Notice: nsmain:
AOLserver/4.5.0 exiting [27/Feb/2007:14:03:38][30740.3083802304][-main-]
Notice: nsmain: AOLserver/4.5.0 starting
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: nsmain: security
info: uid=513, euid=513, gid=513, egid=513
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: nsmain: max files:
FD_SETSIZE = 1024, rl_cur = 1024, rl_max = 1024
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: fastpath[server1]:
mapped GET / [27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice:
fastpath[server1]: mapped HEAD /
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: fastpath[server1]:
mapped POST / [27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice:
adp[server1]: mapped GET /*.adp
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: adp[server1]:
mapped HEAD /*.adp [27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice:
adp[server1]: mapped POST /*.adp
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: modload: loading
'/usr/local/ aolserver/bin/nssock.so'
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: modload: loading
'/usr/local/ aolserver/bin/nslog.so'
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: nslog: opened
'/usr/local/ aolserver/servers/server1/access.log'
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: modload: loading
'/usr/local/ aolserver/bin/nsperm.so'
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: modload: loading
'/usr/local/ aolserver/bin/nsxml.so'
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: nsxml module
starting [27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: conf:
[ns/server/ server1]enabletclpages = 1
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: tcl: enabling .tcl
pages [27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice:
tcl/rewriteurl.tcl: loading test rewrite filters...
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice:
tcl/rewriteurl.tcl: finished loading test rewrite filters.
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: nsmain:
AOLserver/4.5.0 running [27/Feb/2007:14:03:38][30740.3083802304][-main-]
Notice: nsmain: security info: uid=513, euid=513, gid=513, egid=513
[27/Feb/2007:14:03:38][30740.3083802304][-main-] Notice: driver: starting: nssock [27/Feb/2007:14:03:38][30740.3073223584][-sched-] Notice: sched: starting [27/Feb/2007:14:03:38][30740.3071683488][-nssock:driver-] Notice: starting [27/Feb/2007:14:03:38][30740.3071683488][-nssock:driver-] Notice:
nssock: listening on 64.58.34.71:80


Then, when I try to load a page, I get this error is the server.log:

[27/Feb/2007:14:04:15][30740.3071544224][-conn:0-] Notice: rewriteRequest: starturl: '/' [27/Feb/2007:14:04:15][30740.3071544224][-conn:0-] Error: Tcl
exception: invalid command name "ns_rewriteurl"
    while executing
"ns_rewriteurl $new_url"
    (procedure "rewriteRequest" line 10)
    invoked from within
"rewriteRequest preauth"
[27/Feb/2007:14:04:15][30740.3071544224][-conn:0-] Notice: finalURL: URL:
'/'


What am I missing?

Thank you.

Thorpe


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to
<[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the
email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.


Thorpe Mayes
eCognizant LLC
3840 Cobble Circle
Norman, Oklahoma 73072
(405) 514-9753
[EMAIL PROTECTED]


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to