You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Martin Barry <ma...@supine.com> on 2010/02/01 10:08:28 UTC

Re: [users@httpd] proxy chaining to squid

$quoted_author = "David Cotter" ;
> 
> I have two virtual hosts and a squid proxy running. I want to be able to use
> the squid proxy on port 80 though it is running on 3128.

Why? If you describe a bit more exactly what you are trying to achieve it
would help us help you.


> This does not work I get an error when I set my browser to use
> 111.222.22.22:80 as proxy what I want is for apache to chain to squid.

You almost certainly don't want to configure your browser to use Apache as a
generic proxy.

 
> GET /urlrequested.html HTTP/1.1
> 
> Host: localhost:3128
> ...
> Invalid Request

Well, it's an invalid request. Port numbers don't belong in host headers.

cheers
Marty

---------------------------------------------------------------------
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] proxy chaining to squid

Posted by Tom Evans <te...@googlemail.com>.
On Tue, Feb 9, 2010 at 4:55 PM, David Cotter <da...@gmail.com> wrote:
>  Mon, Feb 1, 2010 at 11:29 AM, Brian Mearns <me...@gmail.com> wrote:
>> On Mon, Feb 1, 2010 at 5:33 AM, Emmanuel Bailleul
>> <Em...@telindus.fr> wrote:
>>>
>>>
>>>> -----Message d'origine-----
>>>> De : David Cotter [mailto:davidcotter@gmail.com]
>>>> Envoyé : lundi 1 février 2010 11:30
>>>> À : users@httpd.apache.org
>>>> Objet : Re: [users@httpd] proxy chaining to squid
>>>>
>>>> n Mon, Feb 1, 2010 at 9:08 AM, Martin Barry <ma...@supine.com> wrote:
>>>> > $quoted_author = "David Cotter" ;
>>>> >>
>>>> >> I have two virtual hosts and a squid proxy running. I want to be able
>>>> to use
>>>> >> the squid proxy on port 80 though it is running on 3128.
>>>> >
>>>> > Why? If you describe a bit more exactly what you are trying to achieve
>>>> it
>>>> > would help us help you.
>>>> >
>>>> >
>>>> >> This does not work I get an error when I set my browser to use
>>>> >> 111.222.22.22:80 as proxy what I want is for apache to chain to squid.
>>>> >
>>>> > You almost certainly don't want to configure your browser to use Apache
>>>> as a
>>>> > generic proxy.
>>>> >
>>>> >
>>>> >> GET /urlrequested.html HTTP/1.1
>>>> >>
>>>> >> Host: localhost:3128
>>>> >> ...
>>>> >> Invalid Request
>>>> >
>>>> > Well, it's an invalid request. Port numbers don't belong in host
>>>> headers.
>>>> >
>>>>
>>>> I have a server that runs a web site. I also want that server to host
>>>> a squid http proxy for a different project - but squid has to be
>>>> listening on port 80 and so does the web server. So What I am trying
>>>> do do is send the request appropriately based on domain name. If is is
>>>> xyz.com then send it to the web site otherwise  chain it to squid.
>>>> Thanks,
>>>> David
>>>>
>>>
>>> Hi,
>>>
>>> My previous replies have been rejected because tagged as spam ... hope this time it gets through ...
>>>
>>> If you need your Apache reverse proxy as a frontend, you should have a look at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote as a forward proxy would be more effective than a reverse, the latter only forwards requests to configured origin servers.
>>> Last, but it seems ok in your config, this "forward proxy" setup should be used in the default vhost (the first one listed).
>>>
>>> Regards
>>>
>>> Emmanuel
>>>
>>
>> Do you want a forward proxy or reverse proxy? Based on your config, it
>> looks like you have it set up for reverse proxy. But if you're
>> configuring your browser to know about the proxy, then it's a forward
>> proxy. Not sure if this is the specific problem you're seeing, but I
>> think it will be eventually.
>>
>> Hope that helps,
>> -Brian
>
> Hello I wish to ProxyRemote to squid excpet for when the domain
> required is www.mydomain.com. THe below look ok but doesn't work. IOs
> this possibe?
>
> Thanks,
> David
>
> NameVirtualHost *:80
> Listen 80
>
> <VirtualHost *:80>
> ProxyRemote * http://localhost:8080
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerName www.mydomain.com
> ProxyPass / http://localhost:82/
> ProxyPassReverse / http://localhost:82/
> </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
>
>

Do it in reverse, run the squid proxy on port 80, and force it to go
to apache running on port 8080 for www.mydomain.com.

Something *like* this should do the trick in squid (untested):

# acl with the target domain
acl local_sites dstdomain www.mydomain.com

# real upstream cache
cache_peer 10.0.0.1 parent 3128 0 proxy-only default
# parent 'cache' is really apache
cache_peer localhost parent 8080 0

# route requests where we want them to go
cache_peer_access 10.0.0.1 deny local_sites
cache_peer_access localhost deny !local_sites
never_direct allow all

You probably don't have an upstream proxy, so you will need to read
the squid manual and extrapolate an equivalent configuration, where if
the acl doesn't match it goes direct to the host.

Cheers

Tom

---------------------------------------------------------------------
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] proxy chaining to squid

Posted by David Cotter <da...@gmail.com>.
 Mon, Feb 1, 2010 at 11:29 AM, Brian Mearns <me...@gmail.com> wrote:
> On Mon, Feb 1, 2010 at 5:33 AM, Emmanuel Bailleul
> <Em...@telindus.fr> wrote:
>>
>>
>>> -----Message d'origine-----
>>> De : David Cotter [mailto:davidcotter@gmail.com]
>>> Envoyé : lundi 1 février 2010 11:30
>>> À : users@httpd.apache.org
>>> Objet : Re: [users@httpd] proxy chaining to squid
>>>
>>> n Mon, Feb 1, 2010 at 9:08 AM, Martin Barry <ma...@supine.com> wrote:
>>> > $quoted_author = "David Cotter" ;
>>> >>
>>> >> I have two virtual hosts and a squid proxy running. I want to be able
>>> to use
>>> >> the squid proxy on port 80 though it is running on 3128.
>>> >
>>> > Why? If you describe a bit more exactly what you are trying to achieve
>>> it
>>> > would help us help you.
>>> >
>>> >
>>> >> This does not work I get an error when I set my browser to use
>>> >> 111.222.22.22:80 as proxy what I want is for apache to chain to squid.
>>> >
>>> > You almost certainly don't want to configure your browser to use Apache
>>> as a
>>> > generic proxy.
>>> >
>>> >
>>> >> GET /urlrequested.html HTTP/1.1
>>> >>
>>> >> Host: localhost:3128
>>> >> ...
>>> >> Invalid Request
>>> >
>>> > Well, it's an invalid request. Port numbers don't belong in host
>>> headers.
>>> >
>>>
>>> I have a server that runs a web site. I also want that server to host
>>> a squid http proxy for a different project - but squid has to be
>>> listening on port 80 and so does the web server. So What I am trying
>>> do do is send the request appropriately based on domain name. If is is
>>> xyz.com then send it to the web site otherwise  chain it to squid.
>>> Thanks,
>>> David
>>>
>>
>> Hi,
>>
>> My previous replies have been rejected because tagged as spam ... hope this time it gets through ...
>>
>> If you need your Apache reverse proxy as a frontend, you should have a look at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote as a forward proxy would be more effective than a reverse, the latter only forwards requests to configured origin servers.
>> Last, but it seems ok in your config, this "forward proxy" setup should be used in the default vhost (the first one listed).
>>
>> Regards
>>
>> Emmanuel
>>
>
> Do you want a forward proxy or reverse proxy? Based on your config, it
> looks like you have it set up for reverse proxy. But if you're
> configuring your browser to know about the proxy, then it's a forward
> proxy. Not sure if this is the specific problem you're seeing, but I
> think it will be eventually.
>
> Hope that helps,
> -Brian

Hello I wish to ProxyRemote to squid excpet for when the domain
required is www.mydomain.com. THe below look ok but doesn't work. IOs
this possibe?

Thanks,
David

NameVirtualHost *:80
Listen 80

<VirtualHost *:80>
ProxyRemote * http://localhost:8080
</VirtualHost>

<VirtualHost *:80>
ServerName www.mydomain.com
ProxyPass / http://localhost:82/
ProxyPassReverse / http://localhost:82/
</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


Re: [users@httpd] proxy chaining to squid

Posted by Brian Mearns <me...@gmail.com>.
On Mon, Feb 1, 2010 at 5:33 AM, Emmanuel Bailleul
<Em...@telindus.fr> wrote:
>
>
>> -----Message d'origine-----
>> De : David Cotter [mailto:davidcotter@gmail.com]
>> Envoyé : lundi 1 février 2010 11:30
>> À : users@httpd.apache.org
>> Objet : Re: [users@httpd] proxy chaining to squid
>>
>> n Mon, Feb 1, 2010 at 9:08 AM, Martin Barry <ma...@supine.com> wrote:
>> > $quoted_author = "David Cotter" ;
>> >>
>> >> I have two virtual hosts and a squid proxy running. I want to be able
>> to use
>> >> the squid proxy on port 80 though it is running on 3128.
>> >
>> > Why? If you describe a bit more exactly what you are trying to achieve
>> it
>> > would help us help you.
>> >
>> >
>> >> This does not work I get an error when I set my browser to use
>> >> 111.222.22.22:80 as proxy what I want is for apache to chain to squid.
>> >
>> > You almost certainly don't want to configure your browser to use Apache
>> as a
>> > generic proxy.
>> >
>> >
>> >> GET /urlrequested.html HTTP/1.1
>> >>
>> >> Host: localhost:3128
>> >> ...
>> >> Invalid Request
>> >
>> > Well, it's an invalid request. Port numbers don't belong in host
>> headers.
>> >
>>
>> I have a server that runs a web site. I also want that server to host
>> a squid http proxy for a different project - but squid has to be
>> listening on port 80 and so does the web server. So What I am trying
>> do do is send the request appropriately based on domain name. If is is
>> xyz.com then send it to the web site otherwise  chain it to squid.
>> Thanks,
>> David
>>
>
> Hi,
>
> My previous replies have been rejected because tagged as spam ... hope this time it gets through ...
>
> If you need your Apache reverse proxy as a frontend, you should have a look at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote as a forward proxy would be more effective than a reverse, the latter only forwards requests to configured origin servers.
> Last, but it seems ok in your config, this "forward proxy" setup should be used in the default vhost (the first one listed).
>
> Regards
>
> Emmanuel
>

Do you want a forward proxy or reverse proxy? Based on your config, it
looks like you have it set up for reverse proxy. But if you're
configuring your browser to know about the proxy, then it's a forward
proxy. Not sure if this is the specific problem you're seeing, but I
think it will be eventually.

Hope that helps,
-Brian


-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

---------------------------------------------------------------------
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] proxy chaining to squid

Posted by Emmanuel Bailleul <Em...@telindus.fr>.

> -----Message d'origine-----
> De : David Cotter [mailto:davidcotter@gmail.com]
> Envoyé : lundi 1 février 2010 11:30
> À : users@httpd.apache.org
> Objet : Re: [users@httpd] proxy chaining to squid
> 
> n Mon, Feb 1, 2010 at 9:08 AM, Martin Barry <ma...@supine.com> wrote:
> > $quoted_author = "David Cotter" ;
> >>
> >> I have two virtual hosts and a squid proxy running. I want to be able
> to use
> >> the squid proxy on port 80 though it is running on 3128.
> >
> > Why? If you describe a bit more exactly what you are trying to achieve
> it
> > would help us help you.
> >
> >
> >> This does not work I get an error when I set my browser to use
> >> 111.222.22.22:80 as proxy what I want is for apache to chain to squid.
> >
> > You almost certainly don't want to configure your browser to use Apache
> as a
> > generic proxy.
> >
> >
> >> GET /urlrequested.html HTTP/1.1
> >>
> >> Host: localhost:3128
> >> ...
> >> Invalid Request
> >
> > Well, it's an invalid request. Port numbers don't belong in host
> headers.
> >
> 
> I have a server that runs a web site. I also want that server to host
> a squid http proxy for a different project - but squid has to be
> listening on port 80 and so does the web server. So What I am trying
> do do is send the request appropriately based on domain name. If is is
> xyz.com then send it to the web site otherwise  chain it to squid.
> Thanks,
> David
> 

Hi,

My previous replies have been rejected because tagged as spam ... hope this time it gets through ...

If you need your Apache reverse proxy as a frontend, you should have a look at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote as a forward proxy would be more effective than a reverse, the latter only forwards requests to configured origin servers.
Last, but it seems ok in your config, this "forward proxy" setup should be used in the default vhost (the first one listed).
 
Regards
 
Emmanuel

---------------------------------------------------------------------
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] proxy chaining to squid

Posted by David Cotter <da...@gmail.com>.
n Mon, Feb 1, 2010 at 9:08 AM, Martin Barry <ma...@supine.com> wrote:
> $quoted_author = "David Cotter" ;
>>
>> I have two virtual hosts and a squid proxy running. I want to be able to use
>> the squid proxy on port 80 though it is running on 3128.
>
> Why? If you describe a bit more exactly what you are trying to achieve it
> would help us help you.
>
>
>> This does not work I get an error when I set my browser to use
>> 111.222.22.22:80 as proxy what I want is for apache to chain to squid.
>
> You almost certainly don't want to configure your browser to use Apache as a
> generic proxy.
>
>
>> GET /urlrequested.html HTTP/1.1
>>
>> Host: localhost:3128
>> ...
>> Invalid Request
>
> Well, it's an invalid request. Port numbers don't belong in host headers.
>

I have a server that runs a web site. I also want that server to host
a squid http proxy for a different project - but squid has to be
listening on port 80 and so does the web server. So What I am trying
do do is send the request appropriately based on domain name. If is is
xyz.com then send it to the web site otherwise  chain it to squid.
Thanks,
David

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