Late as ever with a reply, but here's a thought

Several of us were debating this recently as to whether or not to create a module
to do this, or extend nsvhr with the functionality. The conclusion was, you TCL code
runs as fast today as C used to a few years ago.

So with that in mind, what you may want to look at is using ns_register_[proc | adp]
http://www.panoptic.com/wiki/aolserver/Ns_register_proc
or
http://www.panoptic.com/wiki/aolserver/Ns_register_adp
and use ns_conn url and ns_httpsget to forward the request.

For open ssl functionality you need to install nsopenssl
cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/aolserver login
cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/aolserver co nsopenssl

If you wish to change the host headers of ns_httpsget, then you may need to add a few lines
to the default TCL script that comes with nsopenssl

After install, you should find it in <aolserver dir>/modules/tcl/https.tcl and change
https.tcl:   ns_httpsopen

    142         if { $port == 443 } {
    143             set hostheader "Host: ${host}\r"
    144         } else {
    145             set hostheader "Host: ${host}:${port}\r"
    146         }
    147         _ns_https_puts $timeout $wfd $hostheader

To:

  
    142         if { $port == 443 } {
    143             set hostheader "Host: ${host}\r"
    144         } else {
    145             set hostheader "Host: ${host}:${port}\r"
    146         }
    147         # if host header has already been supplied, don't resend
    148         if { [ns_set get $rqset "host"] == "" } {
    149            _ns_https_puts $timeout $wfd $hostheader
    150         }


This should allow you to have something like:
aolserver dir/   (either modules/tcl
                        or
                      servers/<server name>/modules/tcl    , where *.tcl is sourced on start up)
                                /proxy.tcl

ns_register_adp GET /myPath/* <aolserver dir>/servers/<server name>/pages/redirect.adp


Then <aolserver dir>/servers/<server name>/pages/redirect.adp:
<%
    set myUrl [ns_conn url]  ;# or whatever you want to hit
    set backendHost "ssssh.somewhere.com"
    set thisHost [ns_set iget [ns_conn headers] host]
   
    set headersToSend [ns_set create header Host $thisHost]
   
    set url "https://${backendHost}/$myUrl"
    set timeout 3
    set redirectDepth 0
   
   set content [ns_httpsget $url $timeout $redirectDepth $headersToSend]

   ns_adp_puts $content
%>

This gives you a lot more flexibility than mod_proxy

Hope that helps

Patrick


Alastair Young wrote:
From what I can gather from the discussion lists and documentation, there once was a module called nsvhr for AOLS3 which proxied traffic based upon the Host: header. This was primarily used for virtual hosting and was dropped from AOLS4 as AOLS4 has built in virtual hosting capabilities.
 
We have a need to proxy traffic based on the file path. The back end service is another TCP port which will be running an entirely different software package and may be located on another machine. As everything is running under SSL the requst Host: header hostname must match the one in the listenener certificate so nsvhr would not have worked anyway, but perhaps could have been simply modified to work from Path rather than Host.
 
The functionality I am looking for roughly correlates to the Apache "ProxyPass" and "ProxypassReverse" directives.
 
 
Is there functionality I am missing in AOLServer 4 to handle this?
 
This could probably be handled in TCL if it is not in the core . Has anyone invented that wheel?

__________________________________
Alastair Young
Site & Network Operations Manager
Arena Solutions
[EMAIL PROTECTED]
p. 650.687.3516 | m. 925.784.0812 | f. 650.687.3511


arenasolutions.com
120 Constitution Drive, Menlo Park, CA 94025

 

-- 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.

Reply via email to