perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Vanasco <modperl-l...@2xlp.com>
Subject Re: MODPERL and Reverse Proxy
Date Fri, 08 Dec 2006 20:50:56 GMT

On Dec 7, 2006, at 3:37 PM, Sumit Shah wrote:

> I want the request to come to My::RequestHandler FIRST and then go  
> to the ProxyPass Directive. It does not do this. It BYPASSES my  
> handler and goes to the Reverse Proxy.
> I would appreciate any suggestions.

The Apache configuration doesn't process commands in the order that  
they appear.  It processes in the order that the request is  
processed , as per the appropriate hook.

Look at this Apache Core API doc:
	
	http://httpd.apache.org/docs/2.0/developer/request.html

Basically, during the request parsing phase, you have this:

	Hook: translate_name
	Hook: map_to_storage -- mod_proxy is always called here
	Hook: header_parser -- you're calling mod_perl here

Now look at the MP docs
	http://perl.apache.org/docs/2.0/user/handlers/http.html
"""

	From the diagram it can be seen that an HTTP request is processed by  
12 phases, executed in the following order:

		PerlPostReadRequestHandler (PerlInitHandler)
		PerlTransHandler
		PerlMapToStorageHandler
		PerlHeaderParserHandler (PerlInitHandler)
		PerlAccessHandler
		PerlAuthenHandler
		PerlAuthzHandler
		PerlTypeHandler
		PerlFixupHandler
		PerlResponseHandler
		PerlLogHandler
		PerlCleanupHandler
"""


So you've got the chance to call a mp hook on  
PerlPostReadRequestHandler or PerlTransHandler

Unfortunately, for that to happen under the current design of Apache/ 
ModPerl/and ModProxy, you probably won't have the data you want  
available ( i believe you only have access to the URI at that phase )

In order to get what you want done, you'll have to handle the Proxy  
internally -- ie, write a perl handler that will fetch the page using  
LWP or something, and then pass that content on.

See the current thread "using subrequest to different server"

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -


Mime
View raw message