Using multiple backends with custom VCL


#1

I have defined two backends in my service, one for drupal and one for node. The node server is using a subdomain of the drupal server but they have different IP addresses. The backends have names F_LMS_Development_Server (Drupal) and F_LMS_Authorization_Server(Node). I want to send esi requests beginning /esi/node to the Node server so I simply have

if (req.url ~ "/esi/node") {
  set req.backend =  F_LMS_Authorization_Server;
  return (pass);
} 

in vcl_recv. However, all requests to /esi/node still hit the Drupal server and give a 404. A curl request shows the headers were generated by Drupal. I’ve even used ‘set resp.http.X-Backend = req.backend’ in vcl_delver to show the backend it is using and that header is set correctly to F_LMS_Authorization_Server.

Why is my backend change not hitting the second server? What else can I do to debug where the request is actually being sent?

The backend definitions in the compiled VCL are
# Backends
backend F_LMS_Development_Server {
.connect_timeout = 1s;
.dynamic = true;
.port = “80”;
.host = “cache-lypm5ya-s7pmfhvnh2fck.us.platform.sh”;
.first_byte_timeout = 15s;
.max_connections = 200;
.between_bytes_timeout = 10s;
.share_key = “33t1C4hvYoSjs2Q1RuyGUX”;
.probe = {
.request = “HEAD / HTTP/1.1” “Host: cache-lypm5ya-s7pmfhvnh2fck.us.platform.sh” “Connection: close”;
.window = 5;
.threshold = 1;
.timeout = 2s;
.initial = 5;
.dummy = true;
}
}
backend F_LMS_Authorization_Server {
.connect_timeout = 1s;
.dynamic = true;
.port = “80”;
.host = “node.cache-lypm5ya-s7pmfhvnh2fck.us.platform.sh”;
.first_byte_timeout = 15s;
.max_connections = 200;
.between_bytes_timeout = 10s;
.share_key = “33t1C4hvYoSjs2Q1RuyGUX”;
.probe = {
.request = “HEAD / HTTP/1.1” “Host: cache-lypm5ya-s7pmfhvnh2fck.us.platform.sh” “Connection: close”;
.window = 5;
.threshold = 1;
.timeout = 2s;
.initial = 5;
.dummy = true;
}
}


#2

Miked,

As this might require digging through your VCL beside what you’ve included here I recommend sending a support ticket in to support@fastly.com.


#3

Thanks Steven, I’ll do that.