Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Im trying to setup a reverse proxy so that i can have multiple web servers on my network.

I currently have 2 servers:

10.0.0.45 - New Server Webserver/Squid Proxy
10.0.0.40 - Old Server Webserver

i was able to make it so that all traffic on port 1234 on the new server (10.0.0.45) was sent to 80 on the old server (10.0.0.40). but im now having issues when trying to forward domains.

I want to forward like this:

*.arcath.net -> 10.0.0.40
londinium.arcath.net -> 10.0.0.45
support.ed-itsolutions.com -> 10.0.0.40

Im not too bothered if i have to manually add all the subdomains instead of *.

Can anyone give me a config example to do this?

My squid.conf looks like this:

http_port 1234 defaultsite=10.0.0.45:80
cache_peer 10.0.0.40 parent 80 0 no-query originserver name=whitefall
cache_peer_domain whitefall www.arcath.net blog.arcath.net .arcath.net
cache_peer 10.0.0.45 parent 80 0 no-query originserver name=londinium
cache_peer_domain londinium londinium.arcath.net

acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443          # https
acl SSL_ports port 563          # snews
acl SSL_ports port 873          # rsync
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl Safe_ports port 631         # cups
acl Safe_ports port 873         # rsync
acl Safe_ports port 901         # SWAT
acl web dstdomain 10.0.0.40
acl purge method PURGE
acl CONNECT method CONNECT

http_access allow all
http_access allow localhost

At the moment all domains end up going to 10.0.0.45

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

The following contains an example of what you try to achieve: http://wiki.squid-cache.org/ConfigExamples/Reverse/MultipleWebservers

Please try your above configuration changing the defaultsite instruction to

http_port 1234 defaultsite=londinium.arcath.net

According to the squid documentation

defaultsite=domainname
        What to use for the Host: header if it is not present
        in a request. Determines what site (not origin server)
        accelerators should consider the default.
        Implies accel.
share|improve this answer
    
been looking at that, just seems to error all the time –  Arcath Feb 24 '10 at 12:58
    
@Arcath, could you give some information on the errors you receive ? –  Dominik Feb 24 '10 at 13:16
    
Sure, added my config file aswell –  Arcath Feb 24 '10 at 13:21
    
if i remove that get "Invalid Request error was encountered while trying to process the request" when i try to go to any host –  Arcath Feb 24 '10 at 13:45
    
you also need to add: vhost to the http_port line –  Arcath Feb 24 '10 at 13:54
add comment

If you are trying to setup a reverse cache proxy with load balancing...please please read this before you further configure squid. If I misunderstood your needs then just ignore this post.

http://varnish-cache.org/wiki/ArchitectNotes

share|improve this answer
    
im not really doing this for the caching, its so i can run multiple web servers on one external ip –  Arcath Feb 24 '10 at 13:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.