Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8427393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:46:18+00:00 2026-06-10T04:46:18+00:00

I have several backends set up, each one is detected in the VCL and

  • 0

I have several backends set up, each one is detected in the VCL and then the correct set up applied. This works for some of the sites, but a few get pointed to the same site.

I have read this and applied this, it works for some, but not for others.

Configure multiple sites with Varnish

For example I have some backends defined:

backend site4 {
    .host = "127.0.0.1";
    .port = "81";
}

backend site3 {
    .host = "127.0.0.1";
    .port = "81";
}

backend site2 {
    .host = "127.0.0.1";
    .port = "81";
}

backend site1 {
    .host = "127.0.0.1";
    .port = "81";
}

Then in vcl_recv I set the host and the correct backend:

if (req.http.host ~ "(?i)^(www.)?site1.co.uk") 
{
    set req.http.host = "www.site1.co.uk";
    set req.backend = site1;   
} 
elsif (req.http.host ~ "(?i)^(www.)?site2.co.uk") 
{
    set req.http.host = "www.site2.co.uk";
    set req.backend = site2;   
} 
elsif (req.http.host ~ "(?i)^(www.)?site3.com") 
{
    set req.http.host = "www.site3.com";
    set req.backend = site3;
} 
elsif (req.http.host ~ "(?i)^(www.)?site4.net") 
{
    set req.http.host = "www.site4.net";
    set req.backend = site4;
} 

http://www.site1.co.uk works, as does http://www.site2.co.uk, but http://www.site3.com and http://www.site4.net both show the content for http://www.site2.co.uk – it’s like its ignoring my backend and just using the same one for certain sites.

The host is set correctly, because if I do:

curl -I http://site3.com

when using the following in vcl_fetch

set beresp.http.X-Host = req.http.host;  

I can see the host is correctly set as http://www.site3.com

Any ideas anyone?

Side note, is there a shorter method of defining my backends?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:46:19+00:00Added an answer on June 10, 2026 at 4:46 am

    For the sites that had not worked I had not added the new Apache port to the VirtualHost entry

    I had

    <VirtualHost *:80>
    

    It needed to be

    <VirtualHost *:80 *:81>
    

    To work on the new Apache port

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several Delphi programs that maintain connections to a database (some Oracle, some
I have several xml files that are formated this way: <ROOT> <OBJECT> <identity> <id>123</id>
we have several tens of macro enabled excel files, each of those contains few
We have several offices around the US and one in India. Our IT department
In one of my projects I need to collaborate with several backend systems. Some
I have created several custom attributes for my products. I have some that need
How my programs works I have backend with several objects, which have PropetyChanged event.
I have found several topics with this title, but none of their solutions worked
We have some part of our application that need to load a large set
I have several servers on an intranet. I am passing data from one server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.