You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Raymond <su...@bigriverinfotech.com> on 2004/03/17 20:29:43 UTC

[users@httpd] mod_proxy Questions

A couple of questions regarding reverse proxy utilizing mod_proxy:

1) To reverse proxy (web-accelerate) on the same box, typically ( in squid ) 
one would configure httpd to an non-standard port ( say, 82 or 8082 ). Does 
not appear possible with mod_proxy. Does mod_proxy simply intercept the 
"listen" port(s) ?

2) Can mod_proxy be utilized inside VirtualHosts so it is a reverse proxy in 
one virtualhost and a forward proxy in another. If so, how 'bout an example 
or two?

Thanks in advance.

Raymond


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 17 Mar 2004, Raymond wrote:

> A couple of questions regarding reverse proxy utilizing mod_proxy:
>
> 1) To reverse proxy (web-accelerate) on the same box, typically ( in squid )
> one would configure httpd to an non-standard port ( say, 82 or 8082 ). Does
> not appear possible with mod_proxy. Does mod_proxy simply intercept the
> "listen" port(s) ?

I'm not sure I parse that the same as Joshua did.  Port is irrelevant
unless you invoke it in your configuration.  What invokes mod_proxy
(if enabled) is an incoming proxy request.

> 2) Can mod_proxy be utilized inside VirtualHosts so it is a reverse proxy in
> one virtualhost and a forward proxy in another. If so, how 'bout an example
> or two?

Yes.

Joshua gave you a sample configuration.  I would add that there is no
requirement for the virtual hosts to be on different ports - they could
perfectly well be NameVirtualhosts on the same port.  Or even a single
host.

You and one or two others asked supplementary questions following
Joshua's answer.  Can I direct you to my article at
http://www.apacheweek.com/features/reverseproxies
regarding reverse proxy questions?

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Do-Risika RAFIEFERANTSIARONJY <do...@madacom.mg>.
Joshua Slive wrote:
> On Wed, 17 Mar 2004, Raymond wrote:
> 
> 
>>A couple of questions regarding reverse proxy utilizing mod_proxy:
>>
>>1) To reverse proxy (web-accelerate) on the same box, typically ( in squid )
>>one would configure httpd to an non-standard port ( say, 82 or 8082 ). Does
>>not appear possible with mod_proxy. Does mod_proxy simply intercept the
>>"listen" port(s) ?
>>
>>2) Can mod_proxy be utilized inside VirtualHosts so it is a reverse proxy in
>>one virtualhost and a forward proxy in another. If so, how 'bout an example
>>or two?
> 
> 
> Your two questions are related.  They could both be answered with a
> configuration like
> 
> Listen 8082
> Listen 82
> Listen 80
> 
> <VirtualHost _default_:82>
> # Forward proxy
> ProxyRequests On
> ProxyVia On
> 
> <Proxy *>
> Order deny,allow
> Deny from all
> Allow from internal.example.com
> </Proxy>
> </VirtualHost>
> 
> <VirtualHost _default_:8082>
> # Reverse proxy
>  ProxyRequests Off
> 
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
> 
> ProxyPass /foo http://foo.example.com/bar
> ProxyPassReverse /foo http://foo.example.com/bar
> </VirtualHost>

Do you know why mod_proxy is not working when passing through a *http post* 
method ? any tips to surpass it ?


-- 
DouRiX
     ["The mind unlearns with difficulty what it has long learned." -- Lucius
                                 Annaeus Seneca]



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, 17 Mar 2004, Raymond wrote:

>
> > The thing that activates  the reverse proxy is the
> > ProxyPass/ProxyPassReverse directives.
>
> Excellent. One last question:
>
> As the ProxyPass / ProxyPassReverse args are <path> <url>, how does one
> establish a Reverse Proxy from the document root? A relative path of / and
> URL of http://<ip_or_url>/ would appear to only operate on directories below
> the document root, but not the document root itself.

"/" will also match the document root.

(The best way to learn this stuff is to experiment a little.  I get the
impression you haven't tried any of this on your own.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Raymond <su...@bigriverinfotech.com>.
> The thing that activates  the reverse proxy is the
> ProxyPass/ProxyPassReverse directives. 

Excellent. One last question:

As the ProxyPass / ProxyPassReverse args are <path> <url>, how does one 
establish a Reverse Proxy from the document root? A relative path of / and 
URL of http://<ip_or_url>/ would appear to only operate on directories below 
the document root, but not the document root itself.

Basically, what I am trying to achieve is the web-accelerator functionality of 
squid.

Raymond


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, 17 Mar 2004, Raymond wrote:
> 1)Forward Proxy - in example client browser configures for proxy as
> <host-or-ip>:<port>  (same as squid)
>
> 2) Reverse Proxy - This is where I remain unclear. It would appear that for
> the Reverse Proxy to work; the URL would have to include :8082. What I desire
> is a transparent Reverse Proxy: a port 80 web accelerator to a port 8082
> httpd. Would simply configuring for port 80 in lieu of 8082,  including
> ProxyRequests Off and the <proxy *> code block accomplish this? In other
> words, does ProxyRequests Off and <proxy *> code block within a VirtualHosts
> code segment automatically implement Reverse Proxy within a VirtualHost?

Yes, if you want the reverse proxy on the default port, then just
configure the virtual host on the default port.  The thing that activates
the reverse proxy is the ProxyPass/ProxyPassReverse directives.  The
ProxyRequests off is just there to make sure you don't open any security
holes.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Raymond <su...@bigriverinfotech.com>.
> Listen 8082
> Listen 82
> Listen 80
>
> <VirtualHost _default_:82>
> # Forward proxy
> ProxyRequests On
> ProxyVia On
>
> <Proxy *>
> Order deny,allow
> Deny from all
> Allow from internal.example.com
> </Proxy>
> </VirtualHost>
>
> <VirtualHost _default_:8082>
> # Reverse proxy
>  ProxyRequests Off
>
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
>
> ProxyPass /foo http://foo.example.com/bar
> ProxyPassReverse /foo http://foo.example.com/bar
> </VirtualHost>
>
> <VirtualHost _default_:*>
> # Regular server
> DocumentRoot /usr/local/apache2
> </VirtualHost>
>

So,

1)Forward Proxy - in example client browser configures for proxy as 
<host-or-ip>:<port>  (same as squid)

2) Reverse Proxy - This is where I remain unclear. It would appear that for 
the Reverse Proxy to work; the URL would have to include :8082. What I desire 
is a transparent Reverse Proxy: a port 80 web accelerator to a port 8082 
httpd. Would simply configuring for port 80 in lieu of 8082,  including 
ProxyRequests Off and the <proxy *> code block accomplish this? In other 
words, does ProxyRequests Off and <proxy *> code block within a VirtualHosts 
code segment automatically implement Reverse Proxy within a VirtualHost? 

Raymond




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy Questions

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, 17 Mar 2004, Raymond wrote:

> A couple of questions regarding reverse proxy utilizing mod_proxy:
>
> 1) To reverse proxy (web-accelerate) on the same box, typically ( in squid )
> one would configure httpd to an non-standard port ( say, 82 or 8082 ). Does
> not appear possible with mod_proxy. Does mod_proxy simply intercept the
> "listen" port(s) ?
>
> 2) Can mod_proxy be utilized inside VirtualHosts so it is a reverse proxy in
> one virtualhost and a forward proxy in another. If so, how 'bout an example
> or two?

Your two questions are related.  They could both be answered with a
configuration like

Listen 8082
Listen 82
Listen 80

<VirtualHost _default_:82>
# Forward proxy
ProxyRequests On
ProxyVia On

<Proxy *>
Order deny,allow
Deny from all
Allow from internal.example.com
</Proxy>
</VirtualHost>

<VirtualHost _default_:8082>
# Reverse proxy
 ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar
</VirtualHost>

<VirtualHost _default_:*>
# Regular server
DocumentRoot /usr/local/apache2
</VirtualHost>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org