Mailing List Archive

Redirecting traffic to Varnish Cache Server
So I have setup a basic default.vcl and my question how do I get the Varnish server to answer web request before going to the backend drupal servers not sure if I am stating this correctly. Our DNS admin point the urls to Varnish server but I am getting page not found. Am I missing a config in the default.vcl? Thanks! I researched and I am not seeing any good information.

backend drupal {
.host = "drupal.miat.co";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;
}

backend ncwrite {
.host = "ncwrite.miat.co";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;
}

sub vcl_recv {
if (req.http.host == "drupal.miat.co"){
set req.backend_hint = drupal;
} elsif (req.http.host == "ncwrite.miat.co"){
set req.backend_hint = ncwrite;
return (hash);
}
}



This email (including any attachments) may contain confidential information intended solely for acknowledged recipients. If you think you have received this information in error, please reply to the sender and delete all copies from your system. Please note that unauthorized use, disclosure, or further distribution of this information is prohibited by the sender. Note also that we may monitor email directed to or originating from our network. Thank you for your consideration and assistance. |
Re: Redirecting traffic to Varnish Cache Server [ In reply to ]
Hi,

"elsif" needs to be "else if", and I would add:

else {
return(synth(404));
}

at the end to make sure you only serve content from these two domains.

--
Guillaume Quintard

On Tue, Mar 14, 2017 at 9:46 PM, Rodney Bizzell <rbizzell@measinc.com>
wrote:

> So I have setup a basic default.vcl and my question how do I get the
> Varnish server to answer web request before going to the backend drupal
> servers not sure if I am stating this correctly. Our DNS admin point the
> urls to Varnish server but I am getting page not found. Am I missing a
> config in the default.vcl? Thanks! I researched and I am not seeing any
> good information.
>
>
>
> backend drupal {
>
> .host = "drupal.miat.co";
>
> .port = "80";
>
> .connect_timeout = 6000s;
>
> .first_byte_timeout = 6000s;
>
> .between_bytes_timeout = 6000s;
>
> }
>
>
>
> backend ncwrite {
>
> .host = "ncwrite.miat.co";
>
> .port = "80";
>
> .connect_timeout = 6000s;
>
> .first_byte_timeout = 6000s;
>
> .between_bytes_timeout = 6000s;
>
> }
>
>
>
> sub vcl_recv {
>
> if (req.http.host == "drupal.miat.co"){
>
> set req.backend_hint = drupal;
>
> } elsif (req.http.host == "ncwrite.miat.co"){
>
> set req.backend_hint = ncwrite;
>
> return (hash);
>
> }
>
> }
>
>
>
>
> This email (including any attachments) may contain confidential
> information intended solely for acknowledged recipients. If you think you
> have received this information in error, please reply to the sender and
> delete all copies from your system. Please note that unauthorized use,
> disclosure, or further distribution of this information is prohibited by
> the sender. Note also that we may monitor email directed to or originating
> from our network. Thank you for your consideration and assistance. |
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
RE: Redirecting traffic to Varnish Cache Server [ In reply to ]
Don't forget to reply to the ML too :-)

No need to return hash, because you already returned synthetic in that case.

By the way, Dridi told me that vcl actually support "else if", "elsif" and
"elif", so you can disregard my remark about it.

On Mar 16, 2017 15:28, "Rodney Bizzell" <rbizzell@measinc.com> wrote:

Appreciate your help. One question the else {


Return(synth(404));


}



Do I add the return hash underneath it



}



}



*From:* Guillaume Quintard [mailto:guillaume@varnish-software.com]
*Sent:* Thursday, March 16, 2017 4:16 AM
*To:* Rodney Bizzell <rbizzell@measinc.com>
*Cc:* varnish-misc@varnish-cache.org
*Subject:* Re: Redirecting traffic to Varnish Cache Server



Hi,



"elsif" needs to be "else if", and I would add:



else {

return(synth(404));

}



at the end to make sure you only serve content from these two domains.


--

Guillaume Quintard



On Tue, Mar 14, 2017 at 9:46 PM, Rodney Bizzell <rbizzell@measinc.com>
wrote:

So I have setup a basic default.vcl and my question how do I get the
Varnish server to answer web request before going to the backend drupal
servers not sure if I am stating this correctly. Our DNS admin point the
urls to Varnish server but I am getting page not found. Am I missing a
config in the default.vcl? Thanks! I researched and I am not seeing any
good information.



backend drupal {

.host = "drupal.miat.co";

.port = "80";

.connect_timeout = 6000s;

.first_byte_timeout = 6000s;

.between_bytes_timeout = 6000s;

}



backend ncwrite {

.host = "ncwrite.miat.co";

.port = "80";

.connect_timeout = 6000s;

.first_byte_timeout = 6000s;

.between_bytes_timeout = 6000s;

}



sub vcl_recv {

if (req.http.host == "drupal.miat.co"){

set req.backend_hint = drupal;

} elsif (req.http.host == "ncwrite.miat.co"){

set req.backend_hint = ncwrite;

return (hash);

}

}





This email (including any attachments) may contain confidential information
intended solely for acknowledged recipients. If you think you have received
this information in error, please reply to the sender and delete all copies
from your system. Please note that unauthorized use, disclosure, or further
distribution of this information is prohibited by the sender. Note also
that we may monitor email directed to or originating from our network.
Thank you for your consideration and assistance. |


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
RE: Redirecting traffic to Varnish Cache Server [ In reply to ]
Ok thanks I actually changed it no big deal

From: Guillaume Quintard [mailto:guillaume@varnish-software.com]
Sent: Thursday, March 16, 2017 10:38 AM
To: Rodney Bizzell <rbizzell@measinc.com>; varnish-misc <varnish-misc@varnish-cache.org>
Subject: RE: Redirecting traffic to Varnish Cache Server

Don't forget to reply to the ML too :-)

No need to return hash, because you already returned synthetic in that case.

By the way, Dridi told me that vcl actually support "else if", "elsif" and "elif", so you can disregard my remark about it.

On Mar 16, 2017 15:28, "Rodney Bizzell" <rbizzell@measinc.com<mailto:rbizzell@measinc.com>> wrote:
Appreciate your help. One question the else {
Return(synth(404));
}

Do I add the return hash underneath it

}

}

From: Guillaume Quintard [mailto:guillaume@varnish-software.com<mailto:guillaume@varnish-software.com>]
Sent: Thursday, March 16, 2017 4:16 AM
To: Rodney Bizzell <rbizzell@measinc.com<mailto:rbizzell@measinc.com>>
Cc: varnish-misc@varnish-cache.org<mailto:varnish-misc@varnish-cache.org>
Subject: Re: Redirecting traffic to Varnish Cache Server

Hi,

"elsif" needs to be "else if", and I would add:

else {
return(synth(404));
}

at the end to make sure you only serve content from these two domains.

--
Guillaume Quintard

On Tue, Mar 14, 2017 at 9:46 PM, Rodney Bizzell <rbizzell@measinc.com<mailto:rbizzell@measinc.com>> wrote:
So I have setup a basic default.vcl and my question how do I get the Varnish server to answer web request before going to the backend drupal servers not sure if I am stating this correctly. Our DNS admin point the urls to Varnish server but I am getting page not found. Am I missing a config in the default.vcl? Thanks! I researched and I am not seeing any good information.

backend drupal {
.host = "drupal.miat.co<http://drupal.miat.co>";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;
}

backend ncwrite {
.host = "ncwrite.miat.co<http://ncwrite.miat.co>";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;
}

sub vcl_recv {
if (req.http.host == "drupal.miat.co<http://drupal.miat.co>"){
set req.backend_hint = drupal;
} elsif (req.http.host == "ncwrite.miat.co<http://ncwrite.miat.co>"){
set req.backend_hint = ncwrite;
return (hash);
}
}



This email (including any attachments) may contain confidential information intended solely for acknowledged recipients. If you think you have received this information in error, please reply to the sender and delete all copies from your system. Please note that unauthorized use, disclosure, or further distribution of this information is prohibited by the sender. Note also that we may monitor email directed to or originating from our network. Thank you for your consideration and assistance. |

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org<mailto:varnish-misc@varnish-cache.org>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc