aserve proxy/url masquerading
"Andrew K. Wolven" <[email protected]> Fri, 1 Jul 2005 15:16:12 -0500
| Newsgroups | gmane.lisp.open-source.franz |
|---|---|
| Message-ID | <002001c57e79$ba9c3870$0d00a8c0@Schmazelshmox> |
Whatever it's called.
I thought I knew what "proxy" meant until I read the allegroserve
documentation. I was hoping allegroserve does url masquerading, or whatever
it's called. [Basically I wanted requests to allegroserve to be forwarded
to another server and responses routed back.] I looked at the function and
found an argument to net.aserve:start :proxy-proxy. I found out from
looking at the code that proxy-proxy adds one more feature to proxy.
Instead of doing a request on behalf of the web client directly, it sends
the request to a different domain/port so that the reciever there is a
proxy. How would that be different from being an actual server downstream?
So I tried :proxy-proxy "schmazelshmox:81", but it didn't work. I wanted
requests coming in to allegroserve to be handled downstream by an apache
server on the same machine but different port. So I kludged the code. I
added:
(setf (uri-host uri) (car (entity-extra ent))
(uri-port uri) (cdr (entity-extra ent))
(uri-scheme uri) :http))
to
(defun enable-proxy (&key (server *wserver*)
proxy-proxy)
...
(make-instance 'locator-proxy
:name :proxy
:extra (make-instance 'computed-entity
:function #'(lambda (req ent)
(let ((uri (request-raw-uri req)))
(setf (uri-host uri) (car (entity-extra ent))
(uri-port uri) (cdr (entity-extra ent))
(uri-scheme uri) :http))
(do-proxy-request req ent))
sorry for the code indentation
and
(setf (uri-scheme (request-raw-uri req)) :http)
to
(defmethod standard-locator ((req http-request) (locator locator-proxy))
;; see if this is a proxy request and if so return the entity that
;; denotes we're proxying
(if* (setf (uri-scheme (request-raw-uri req)) :http)
then ; compute entity object
(locator-extra locator)))
And it works.
I'm sure somebody more familiar with the internals of this area can get this
working in a nicer fashion. Maybe it's really supposed to work w/o this
anyway. [Bug fix]
Wouldn't it be great if you could have a publish method that maps urls
and/or domains/ports to other urls and or domains/ports?
Marc Battyani was once talking about mod_lisp somewhere. JKF (I think) said
something to the effect of "why don't you just have apache forward the http
request to allegroserve or other lisp server? It's gonna be the basically
the same protocol essentially and do the same thing."
Well now, you can have allegroserve forward your http requests to your
favorite lisp web application server such as allegroserve.
AKW