Re: custom proxy setup with mod_perl

Torsten Förtsch <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 11/23/2012 06:39 PM, André Warnier wrote:
> 1) is that "early enough" to be before the Apache ProxyPass step ?

yes, the proxy works as usual in the response phase.

> 2) can I set the "(corresponding hostname)" above in such a Perl
> handler, or otherwise manipulate the URI before it gets proxy-ed ?

yes

> 3) do I need this ProxyPass directive in my configuration, or can I just
> set the Apache response handler to be mod_proxy_http, in one of the Perl
> handlers ? and if yes, how ?

no, the fixup handler can configure the request to be handled by mod_proxy.

  # Perhaps 2 is better here, since your server actually acts as
  # reverse proxy. The differences are subtle. Have a look at the code
  # for better understanding.
  $r->proxyreq(1);
  $r->filename("proxy:".$url);
  $r->handler('proxy_server');

That's what I would begin with. $url is then 'http://www.site-...'.

A problem here is perhaps if the user wants to use https. You can of
course fake up a certificate. You perhaps can even have the browser
accept it without warning. But nevertheless, a user with sufficient
knowledge can identify the man in the middle.

See also

  http://foertsch.name/ModPerl-Tricks/using-modproxy-as-useragent.shtml

for a different but also unusual usage of mod_proxy.

Torsten
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.