LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-09-2009, 05:59 AM   #1
triptec
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Rep: Reputation: 0
Squid reverse proxy


I've been battling with this for a few days now and I'm ready to give up. So I'm gonna give this a last shot.

In my apartment I've got 3 computer acting as servers. Here's my setup.

Gateway (Debian, Squid3(80,8080), Shorewall)
eth0
192.168.0.1
eth1
79.136.x.x

webserver1.com (Ubuntu, Apache2(80), Tomcat6(8080))
eth0
192.168.0.45

webserver2.com (Debian, Apache2(80))
eth0
192.168.0.55

Both webserver1.com and webserver2.com points to 79.136.x.x

What I want is to have squid to relay requests to *.webserver1.com:80 to 192.168.0.45:80, requests to *.webserver1.com:8080 to 192.168.0.45:8080 and lastly requests to *.webserver2.com:80 to 192.168.0.55:80.

I thought this would be the simplest thing. I kinda do know my way around documentation and google, but it seems I'm out of luck. I've tried a very simple conf that I thought would do something similar to what I want to do.


acl all src 0.0.0.0/0
acl webserver1_com dstdomain .webserver1.com
acl webserver2_com dstdomain .webserver2.com
acl p80 port 80
acl p8080 port 8080

http_access allow all

http_port 80 vhost defaultsite=webserver1.com
http_port 8080 vhost defaultsite=webserver1.com

cache_peer 192.168.0.45 parent 80 0 no-query originserver name=webserver1_80 login=PASS
cache_peer_access webserver1_80 allow webserver1_com
cache_peer_access webserver1_80 deny !p80

cache_peer 192.168.0.45 parent 8080 0 no-query originserver name=webserver1_8080 login=PASS
cache_peer_access webserver1_8080 allow webserver1_com
cache_peer_access webserver1_8080 deny !p8080

cache_peer 192.168.0.55 parent 80 0 no-query originserver name=webserver2_80 login=PASS
cache_peer_access webserver2_80 allow webserver1_com
cache_peer_access webserver2_80 deny !p80

cache deny all

This does not seem to work one bit, I get webserver1.com:80 for webserver1.com:80/8080 and webserver2.com:80, but I get webserver1:8080 for webserver2.com:8080. Could someone point me in the right direction? I guess I'm doing something wrong with the acl but this seems like it should be simple.

Thanks for reading thing far
//Andreas
 
Old 12-09-2009, 03:30 PM   #2
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES11 / FC20/ OES / CentOS
Posts: 601

Rep: Reputation: 32
why not use portforwarding ?

Maybe take a look at iptables. That can for sure do the job.

Another idea could be manipulating the name resolution via /etc/hosts.
 
Old 12-10-2009, 03:00 AM   #3
triptec
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by saavik View Post
why not use portforwarding ?

Maybe take a look at iptables. That can for sure do the job.

Another idea could be manipulating the name resolution via /etc/hosts.
Well, I got squid so I wouldn't need portforward for this and yeah, I'm using name resolution now but I don't want to and it's making me f**king furious as I think it should be so simple...
 
Old 12-10-2009, 05:29 AM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

I have reverse proxy working like a charm for multiple subdomains, http and https, under the same domain.com name, for example site1.domain.com, site2.domain.com and directing them to different peers based on the domain name in the http header. If it can help you I'll post the config I have, but not sure how to adapt it to work for two domain names on the same Squid. Just let me know if it would help you.

Kind regards,

Eric
 
Old 12-12-2009, 08:34 AM   #5
triptec
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EricTRA View Post
Hi,

I have reverse proxy working like a charm for multiple subdomains, http and https, under the same domain.com name, for example site1.domain.com, site2.domain.com and directing them to different peers based on the domain name in the http header. If it can help you I'll post the config I have, but not sure how to adapt it to work for two domain names on the same Squid. Just let me know if it would help you.

Kind regards,

Eric
Thanks but it's okay.. I've done it that way, but I would like to know why my acl's doesn't work as I expect with ports..
 
Old 12-12-2009, 08:44 AM   #6
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

I cannot help you out on that one, I've looked at your post and compared with my config, but don't see anything wrong in your config. But then again, I'm not an experienced Squid user. I hope someone can help you find an answer.

Kind regards,

Eric
 
  


Reply

Tags
squid


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with a Squid Reverse Proxy robinBones Linux - Networking 5 09-10-2009 04:09 PM
Squid 2.6 Reverse Proxy from Squid(3128) to OrginServer(80) Not working rraj Linux - Server 0 06-06-2008 02:29 PM
SQUID-Reverse Proxy haariseshu Linux - Newbie 3 02-05-2008 05:59 AM
Squid as Reverse Proxy and LAN proxy? zivota Linux - Security 2 02-26-2007 05:00 PM
Reverse Proxy in squid winxandlinx Linux - Networking 3 12-04-2006 05:30 AM


All times are GMT -5. The time now is 02:05 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration