Mailing List Archive

Varnish on stand-alone server
I'm setting up a web development cluster with 3 or 4 backend webservers. Because this is all offline at the moment, provisioning this with vagrant and ansible in a private network of servers with no fqdn. I have no problem getting varnish to connect to the backends over port 80 from within the varnish VM itself over lynx and curl, but from outside the VM on my host machine, varnish is unaware of the backends. Varnish works fine if I install it on the same machine as apache but if I try to run it in its own virtual machine. I would like to simulate a production environment as much as possible when all of the server names are fully qualified.


Can anyone suggest ways I might get varnish to provide caching from browsers on my host machine while running in its own virtual machine in a cluster?


Thanks a ton
Re: Varnish on stand-alone server [ In reply to ]
Looks like a vagrant problem rather than a Varnish one. Sadly, I can't help
you on that one.

--
Guillaume Quintard
Re: Varnish on stand-alone server [ In reply to ]
On Thu, Jan 19, 2017 at 06:28:45AM +0000, Stalker, Tim wrote:

> I have no problem getting varnish to connect to the backends over port 80
> from within the varnish VM itself over lynx and curl, but from outside the VM
> on my host machine, varnish is unaware of the backends.

Unaware, how?

What did you try already? what doesn't work? Logs?

--
Andreas

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
I guess it?s not a firewall issue since you say you can reach the
backends with curl or wget, maybe the acl purge is not correctly
configured in the backends?

On 01/19/17 7:28 AM, Stalker, Tim wrote:
> I'm setting up a web development cluster with 3 or 4 backend webservers.
> Because this is all offline at the moment, provisioning this with
> vagrant and ansible in a private network of servers with no fqdn. I have
> no problem getting varnish to connect to the backends over port 80
> from within the varnish VM itself over lynx and curl, but from outside
> the VM on my host machine, varnish is unaware of the backends. Varnish
> works fine if I install it on the same machine as apache but if I try to
> run it in its own virtual machine. I would like to simulate a production
> environment as much as possible when all of the server names are fully
> qualified.
>
>
> Can anyone suggest ways I might get varnish to provide caching from
> browsers on my host machine while running in its own virtual machine in
> a cluster?
>
>
> Thanks a ton
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
Varnish is aware of the backend I have set and works fine as long as I'm logged into its virtual machine and run either curl or lynx to the address of the machine with apache running. I have my /etc/hosts file set with the backend address and virtual host as configured in the apache box, but it seems that varnish ignores the /etc/hosts file. I get logging and see the headers when I run curl -I http://backend.vhost.name<http://backend.vhost.name/> but when I do the same thing via the browser, curl, or lynx on my host computer, no logging, nothing happens inside the varnish vm.

It's probably some sort of networking config on the virtual machines themselves. One thing about the documentation surrounding varnish is that it all assumes varnish is to be installed on the same server as apache, nginx, or whatever one's frontend is. There's little if anything I can find as to how to run varnish on its own server, either virtually with no fully qualified domain name or virtually with DNS set appropriately. Are there any pointers I could go to for how to set DNS, for example? Does one point the A record to varnish or apache?

Thanks again all. Any insight you can provide would be great.

Tim


________________________________
From: Miguel Gonz?lez <miguel_3_gonzalez@yahoo.es>
Sent: Thursday, January 19, 2017 3:48:26 AM
To: Stalker, Tim; varnish-misc@varnish-cache.org
Subject: Re: Varnish on stand-alone server

I guess it?s not a firewall issue since you say you can reach the
backends with curl or wget, maybe the acl purge is not correctly
configured in the backends?

On 01/19/17 7:28 AM, Stalker, Tim wrote:
> I'm setting up a web development cluster with 3 or 4 backend webservers.
> Because this is all offline at the moment, provisioning this with
> vagrant and ansible in a private network of servers with no fqdn. I have
> no problem getting varnish to connect to the backends over port 80
> from within the varnish VM itself over lynx and curl, but from outside
> the VM on my host machine, varnish is unaware of the backends. Varnish
> works fine if I install it on the same machine as apache but if I try to
> run it in its own virtual machine. I would like to simulate a production
> environment as much as possible when all of the server names are fully
> qualified.
>
>
> Can anyone suggest ways I might get varnish to provide caching from
> browsers on my host machine while running in its own virtual machine in
> a cluster?
>
>
> Thanks a ton
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
Re: Varnish on stand-alone server [ In reply to ]
It would seem that if running varnish on its own server, the backend host must point to a fqdn.

________________________________
From: Stalker, Tim
Sent: Wednesday, January 18, 2017 11:28:45 PM
To: varnish-misc@varnish-cache.org
Subject: Varnish on stand-alone server


I'm setting up a web development cluster with 3 or 4 backend webservers. Because this is all offline at the moment, provisioning this with vagrant and ansible in a private network of servers with no fqdn. I have no problem getting varnish to connect to the backends over port 80 from within the varnish VM itself over lynx and curl, but from outside the VM on my host machine, varnish is unaware of the backends. Varnish works fine if I install it on the same machine as apache but if I try to run it in its own virtual machine. I would like to simulate a production environment as much as possible when all of the server names are fully qualified.


Can anyone suggest ways I might get varnish to provide caching from browsers on my host machine while running in its own virtual machine in a cluster?


Thanks a ton
Re: Varnish on stand-alone server [ In reply to ]
You can use local dns or trick your system using hosts file to have your
own local domain.


On 01/19/17 10:32 PM, Stalker, Tim wrote:
> It would seem that if running varnish on its own server, the backend
> host must point to a fqdn.
>
> ------------------------------------------------------------------------
> *From:* Stalker, Tim
> *Sent:* Wednesday, January 18, 2017 11:28:45 PM
> *To:* varnish-misc@varnish-cache.org
> *Subject:* Varnish on stand-alone server
>
>
> I'm setting up a web development cluster with 3 or 4 backend webservers.
> Because this is all offline at the moment, provisioning this with
> vagrant and ansible in a private network of servers with no fqdn. I have
> no problem getting varnish to connect to the backends over port 80
> from within the varnish VM itself over lynx and curl, but from outside
> the VM on my host machine, varnish is unaware of the backends. Varnish
> works fine if I install it on the same machine as apache but if I try to
> run it in its own virtual machine. I would like to simulate a production
> environment as much as possible when all of the server names are fully
> qualified.
>
>
> Can anyone suggest ways I might get varnish to provide caching from
> browsers on my host machine while running in its own virtual machine in
> a cluster?
>
>
> Thanks a ton
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
On Thu, Jan 19, 2017 at 09:32:03PM +0000, Stalker, Tim wrote:

> It would seem that if running varnish on its own server, the backend host
> must point to a fqdn.

That is not the case. Varnish resolves the backend using getaddrinfo(3).

--
Andreas

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
> Varnish is aware of the backend I have set and works fine as long as I'm
> logged into its virtual machine and run either curl or lynx to the address of
> the machine with apache running. I have my /etc/hosts file set with the
> backend address and virtual host as configured in the apache box, but it
> seems that varnish ignores the /etc/hosts file. I get logging and see the
> headers when I run curl -I
> http://backend.vhost.name<http://backend.vhost.name/> but when I do the same
> thing via the browser, curl, or lynx on my host computer, no logging, nothing
> happens inside the varnish vm.

You're not giving us any info that actually enables us to help you. What
doesn't work? What error messages do you get? What did you already try? What
were the results of these attempts? What is in the log?

Most important is:

What doesn't work? You've only stated that it doesn't work, not what is
actually happening when you've determined that it doesn't work.

--
Andreas

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
I can't provide much detail because I don't get any reports or data from varnishlog. No errors are reported. When I run "varnishadm backend.list", the backend is reported as healthy. Plus, there's no issues with varnish communicating with the backend when I visit the backend host from within the varnish virtual machine. Everything works as intended when I run a web client (curl or lynx) from the varnish vm terminal. The problem is varnish doesn't communicate with the backend when I visit the backend host from outside the vm on my host computer's web browser.


The setup is is this - two virtual machines running in vagrant and virtualbox


192.168.33.26 (apache box with hostname clas-test.myhost.pvt listening on port 84)

192.168.33.27 (clas-varnish.myhost.pvt)


From default.vcl:


vcl 4.0;
import std;
import directors;

include "backends.vcl";


sub vcl_init {

new local_test = directors.round_robin();
local_test.add_backend(express_test);
}
sub vcl_recv {

if (server.hostname == "clas-test.hostname.pvt") {
set req.backend_hint = local_test.backend();
}
}
sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
std.log("hitmiss:HIT");
} else {
set resp.http.X-Cache = "MISS";
std.log("hitmiss:MISS");
}
}


From backends.vcl:


backend express_test {
.host = "192.168.33.26"; #ip of my host in its own virtual machine
.port = "84"; #port I have set in the virtual host on my host's virtual machine
}

In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to port 80 and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set the address to my backend ip, varnish won't start and I get this error:

bind(): Cannot assign requested address
[19743]: Error: Failed to open (any) accept sockets.

And yet when I run "varnishadm backend.list" with the listen address commented out, the backend is reported as healthy.

Thanks again, all




________________________________
From: varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org <varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org> on behalf of Andreas Plesner <apj@mutt.dk>
Sent: Friday, January 20, 2017 2:59:10 AM
To: varnish-misc@varnish-cache.org
Subject: Re: Varnish on stand-alone server

On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
> Varnish is aware of the backend I have set and works fine as long as I'm
> logged into its virtual machine and run either curl or lynx to the address of
> the machine with apache running. I have my /etc/hosts file set with the
> backend address and virtual host as configured in the apache box, but it
> seems that varnish ignores the /etc/hosts file. I get logging and see the
> headers when I run curl -I
> http://backend.vhost.name<http://backend.vhost.name/> but when I do the same
> thing via the browser, curl, or lynx on my host computer, no logging, nothing
> happens inside the varnish vm.

You're not giving us any info that actually enables us to help you. What
doesn't work? What error messages do you get? What did you already try? What
were the results of these attempts? What is in the log?

Most important is:

What doesn't work? You've only stated that it doesn't work, not what is
actually happening when you've determined that it doesn't work.

--
Andreas

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
On Fri, Jan 20, 2017 at 04:38:57PM +0000, Stalker, Tim wrote:

> The problem is varnish doesn't communicate with the backend when I visit the
> backend host from outside the vm on my host computer's web browser.

How do you know? How do *WE* know?

> In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to port 80
> and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set the address
> to my backend ip, varnish won't start and I get this error:

I would assume that VARNISH_LISTEN_ADDRESS is where varnish listens for
connections, not the address of the backend, but that is specific to the
packaging done for your OS.

--
Andreas

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
What about the acl purge entries?

You probably know that you have to add in your hosts file where you are
running your browser you have to point the domain you are hitting with
the ip address of your varnish VM, don?t you?

Miguel




On 01/20/17 5:38 PM, Stalker, Tim wrote:
> I can't provide much detail because I don't get any reports or data from
> varnishlog. No errors are reported. When I run "varnishadm
> backend.list", the backend is reported as healthy. Plus, there's no
> issues with varnish communicating with the backend when I visit the
> backend host from within the varnish virtual machine. Everything works
> as intended when I run a web client (curl or lynx) from the varnish vm
> terminal. The problem is varnish doesn't communicate with the backend
> when I visit the backend host from outside the vm on my host computer's
> web browser.
>
>
> The setup is is this - two virtual machines running in vagrant and
> virtualbox
>
>
> 192.168.33.26 (apache box with hostname clas-test.myhost.pvt listening
> on port 84)
>
> 192.168.33.27 (clas-varnish.myhost.pvt)
>
>
> From default.vcl:
>
>
> vcl 4.0;
> import std;
> import directors;
>
> include "backends.vcl";
>
> sub vcl_init {
>
> new local_test = directors.round_robin();
> local_test.add_backend(express_test);
> }
> sub vcl_recv {
>
> if (server.hostname == "clas-test.hostname.pvt") {
> set req.backend_hint = local_test.backend();
> }
> }
> sub vcl_deliver {
> if (obj.hits > 0) {
> set resp.http.X-Cache = "HIT";
> std.log("hitmiss:HIT");
> } else {
> set resp.http.X-Cache = "MISS";
> std.log("hitmiss:MISS");
> }
> }
>
> From backends.vcl:
>
>
> backend express_test {
> .host = "192.168.33.26"; #ip of my host in its own virtual machine
> .port = "84"; #port I have set in the virtual host on my host's
> virtual machine
> }
>
> In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to
> port 80 and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set
> the address to my backend ip, varnish won't start and I get this error:
>
> bind(): Cannot assign requested address
> [19743]: Error: Failed to open (any) accept sockets.
>
> And yet when I run "varnishadm backend.list" with the listen address
> commented out, the backend is reported as healthy.
>
> Thanks again, all
>
>
>
> ------------------------------------------------------------------------
> *From:* varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org
> <varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org> on
> behalf of Andreas Plesner <apj@mutt.dk>
> *Sent:* Friday, January 20, 2017 2:59:10 AM
> *To:* varnish-misc@varnish-cache.org
> *Subject:* Re: Varnish on stand-alone server
>
> On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
>> Varnish is aware of the backend I have set and works fine as long as I'm
>> logged into its virtual machine and run either curl or lynx to the address of
>> the machine with apache running. I have my /etc/hosts file set with the
>> backend address and virtual host as configured in the apache box, but it
>> seems that varnish ignores the /etc/hosts file. I get logging and see the
>> headers when I run curl -I
>> http://backend.vhost.name<http://backend.vhost.name/> but when I do the same
>> thing via the browser, curl, or lynx on my host computer, no logging, nothing
>> happens inside the varnish vm.
>
> You're not giving us any info that actually enables us to help you. What
> doesn't work? What error messages do you get? What did you already try? What
> were the results of these attempts? What is in the log?
>
> Most important is:
>
> What doesn't work? You've only stated that it doesn't work, not what is
> actually happening when you've determined that it doesn't work.
>
> --
> Andreas
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Varnish on stand-alone server [ In reply to ]
Yes, when I point the backend host to the ip of the varnish virtual machine in my host computer's /etc/hosts file, I get this response in the varnish log on the varnish vm:


* << BeReq >> 17
- Begin bereq 16 fetch
- Timestamp Start: 1485021291.247201 0.000000 0.000000
- BereqMethod GET
- BereqURL /
- BereqProtocol HTTP/1.1
- BereqHeader Host: clas-test.myvhost.pvt
- BereqHeader Upgrade-Insecure-Requests: 1
- BereqHeader User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
- BereqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
- BereqHeader Accept-Language: en-US,en;q=0.8
- BereqHeader X-Forwarded-For: 192.168.33.1
- BereqHeader Accept-Encoding: gzip
- BereqHeader X-Varnish: 17
- VCL_call BACKEND_FETCH
- VCL_return fetch
- FetchError no backend connection
- Timestamp Beresp: 1485021291.247212 0.000011 0.000011
- Timestamp Error: 1485021291.247215 0.000013 0.000002
- BerespProtocol HTTP/1.1
- BerespStatus 503
- BerespReason Service Unavailable
- BerespReason Backend fetch failed
- BerespHeader Date: Sat, 21 Jan 2017 17:54:51 GMT
- BerespHeader Server: Varnish
- VCL_call BACKEND_ERROR
- BerespHeader Content-Type: text/html; charset=utf-8
- VCL_return deliver
- Storage malloc Transient
- ObjProtocol HTTP/1.1
- ObjStatus 503
- ObjReason Backend fetch failed
- ObjHeader Date: Sat, 21 Jan 2017 17:54:51 GMT
- ObjHeader Server: Varnish
- ObjHeader Content-Type: text/html; charset=utf-8
- Length 27910
- BereqAcct 0 0 0 0 0 0
- End


* << Session >> 163842
- Begin sess 0 HTTP/1
- SessOpen 192.168.33.1 40398 :80 192.168.33.27 80 1485021291.241650 16
- SessClose RX_TIMEOUT 5.094
- End

* << Session >> 131074
- Begin sess 0 HTTP/1
- SessOpen 192.168.33.1 40400 :80 192.168.33.27 80 1485021291.241657 17
- SessClose RX_TIMEOUT 5.094
- End

* << Session >> 15
- Begin sess 0 HTTP/1
- SessOpen 192.168.33.1 40396 :80 192.168.33.27 80 1485021291.241622 14
- Link req 16 rxreq
- Link req 18 rxreq
- SessClose RX_TIMEOUT 5.395
- End


Any ideas? I can only think that it's a networking issue because the same setup I have, same default.vcl, backends.vcl files, with apache installed on the same VM as varnish, works fine. The backend host when separate from varnish in its own VM also works fine. But varnish cannot connect to it.

________________________________
From: Miguel Gonz?lez <miguel_3_gonzalez@yahoo.es>
Sent: Friday, January 20, 2017 3:18:51 PM
To: Stalker, Tim; Andreas Plesner; varnish-misc@varnish-cache.org
Subject: Re: Varnish on stand-alone server

What about the acl purge entries?

You probably know that you have to add in your hosts file where you are
running your browser you have to point the domain you are hitting with
the ip address of your varnish VM, don?t you?

Miguel




On 01/20/17 5:38 PM, Stalker, Tim wrote:
> I can't provide much detail because I don't get any reports or data from
> varnishlog. No errors are reported. When I run "varnishadm
> backend.list", the backend is reported as healthy. Plus, there's no
> issues with varnish communicating with the backend when I visit the
> backend host from within the varnish virtual machine. Everything works
> as intended when I run a web client (curl or lynx) from the varnish vm
> terminal. The problem is varnish doesn't communicate with the backend
> when I visit the backend host from outside the vm on my host computer's
> web browser.
>
>
> The setup is is this - two virtual machines running in vagrant and
> virtualbox
>
>
> 192.168.33.26 (apache box with hostname clas-test.myhost.pvt listening
> on port 84)
>
> 192.168.33.27 (clas-varnish.myhost.pvt)
>
>
> From default.vcl:
>
>
> vcl 4.0;
> import std;
> import directors;
>
> include "backends.vcl";
>
> sub vcl_init {
>
> new local_test = directors.round_robin();
> local_test.add_backend(express_test);
> }
> sub vcl_recv {
>
> if (server.hostname == "clas-test.hostname.pvt") {
> set req.backend_hint = local_test.backend();
> }
> }
> sub vcl_deliver {
> if (obj.hits > 0) {
> set resp.http.X-Cache = "HIT";
> std.log("hitmiss:HIT");
> } else {
> set resp.http.X-Cache = "MISS";
> std.log("hitmiss:MISS");
> }
> }
>
> From backends.vcl:
>
>
> backend express_test {
> .host = "192.168.33.26"; #ip of my host in its own virtual machine
> .port = "84"; #port I have set in the virtual host on my host's
> virtual machine
> }
>
> In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to
> port 80 and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set
> the address to my backend ip, varnish won't start and I get this error:
>
> bind(): Cannot assign requested address
> [19743]: Error: Failed to open (any) accept sockets.
>
> And yet when I run "varnishadm backend.list" with the listen address
> commented out, the backend is reported as healthy.
>
> Thanks again, all
>
>
>
> ------------------------------------------------------------------------
> *From:* varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org
> <varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org> on
> behalf of Andreas Plesner <apj@mutt.dk>
> *Sent:* Friday, January 20, 2017 2:59:10 AM
> *To:* varnish-misc@varnish-cache.org
> *Subject:* Re: Varnish on stand-alone server
>
> On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
>> Varnish is aware of the backend I have set and works fine as long as I'm
>> logged into its virtual machine and run either curl or lynx to the address of
>> the machine with apache running. I have my /etc/hosts file set with the
>> backend address and virtual host as configured in the apache box, but it
>> seems that varnish ignores the /etc/hosts file. I get logging and see the
>> headers when I run curl -I
>> http://backend.vhost.name<http://backend.vhost.name/> but when I do the same
>> thing via the browser, curl, or lynx on my host computer, no logging, nothing
>> happens inside the varnish vm.
>
> You're not giving us any info that actually enables us to help you. What
> doesn't work? What error messages do you get? What did you already try? What
> were the results of these attempts? What is in the log?
>
> Most important is:
>
> What doesn't work? You've only stated that it doesn't work, not what is
> actually happening when you've determined that it doesn't work.
>
> --
> Andreas
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
Re: Varnish on stand-alone server [ In reply to ]
What about the acl purge list in the default.vcl file?


On 01/21/17 7:04 PM, Stalker, Tim wrote:
> Yes, when I point the backend host to the ip of the varnish virtual
> machine in my host computer's /etc/hosts file, I get this response in
> the varnish log on the varnish vm:
>
>
> * << BeReq >> 17
> - Begin bereq 16 fetch
> - Timestamp Start: 1485021291.247201 0.000000 0.000000
> - BereqMethod GET
> - BereqURL /
> - BereqProtocol HTTP/1.1
> - BereqHeader Host: clas-test.myvhost.pvt
> - BereqHeader Upgrade-Insecure-Requests: 1
> - BereqHeader User-Agent: Mozilla/5.0 (X11; Linux x86_64)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
> - BereqHeader Accept:
> text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
> - BereqHeader Accept-Language: en-US,en;q=0.8
> - BereqHeader X-Forwarded-For: 192.168.33.1
> - BereqHeader Accept-Encoding: gzip
> - BereqHeader X-Varnish: 17
> - VCL_call BACKEND_FETCH
> - VCL_return fetch
> - FetchError no backend connection
> - Timestamp Beresp: 1485021291.247212 0.000011 0.000011
> - Timestamp Error: 1485021291.247215 0.000013 0.000002
> - BerespProtocol HTTP/1.1
> - BerespStatus 503
> - BerespReason Service Unavailable
> - BerespReason Backend fetch failed
> - BerespHeader Date: Sat, 21 Jan 2017 17:54:51 GMT
> - BerespHeader Server: Varnish
> - VCL_call BACKEND_ERROR
> - BerespHeader Content-Type: text/html; charset=utf-8
> - VCL_return deliver
> - Storage malloc Transient
> - ObjProtocol HTTP/1.1
> - ObjStatus 503
> - ObjReason Backend fetch failed
> - ObjHeader Date: Sat, 21 Jan 2017 17:54:51 GMT
> - ObjHeader Server: Varnish
> - ObjHeader Content-Type: text/html; charset=utf-8
> - Length 27910
> - BereqAcct 0 0 0 0 0 0
> - End
>
>
> * << Session >> 163842
> - Begin sess 0 HTTP/1
> - SessOpen 192.168.33.1 40398 :80 192.168.33.27 80
> 1485021291.241650 16
> - SessClose RX_TIMEOUT 5.094
> - End
>
> * << Session >> 131074
> - Begin sess 0 HTTP/1
> - SessOpen 192.168.33.1 40400 :80 192.168.33.27 80
> 1485021291.241657 17
> - SessClose RX_TIMEOUT 5.094
> - End
>
> * << Session >> 15
> - Begin sess 0 HTTP/1
> - SessOpen 192.168.33.1 40396 :80 192.168.33.27 80
> 1485021291.241622 14
> - Link req 16 rxreq
> - Link req 18 rxreq
> - SessClose RX_TIMEOUT 5.395
> - End
>
>
> Any ideas? I can only think that it's a networking issue because the
> same setup I have, same default.vcl, backends.vcl files, with apache
> installed on the same VM as varnish, works fine. The backend host when
> separate from varnish in its own VM also works fine. But varnish cannot
> connect to it.
>
> ------------------------------------------------------------------------
> *From:* Miguel Gonz?lez <miguel_3_gonzalez@yahoo.es>
> *Sent:* Friday, January 20, 2017 3:18:51 PM
> *To:* Stalker, Tim; Andreas Plesner; varnish-misc@varnish-cache.org
> *Subject:* Re: Varnish on stand-alone server
>
> What about the acl purge entries?
>
> You probably know that you have to add in your hosts file where you are
> running your browser you have to point the domain you are hitting with
> the ip address of your varnish VM, don?t you?
>
> Miguel
>
>
>
>
> On 01/20/17 5:38 PM, Stalker, Tim wrote:
>> I can't provide much detail because I don't get any reports or data from
>> varnishlog. No errors are reported. When I run "varnishadm
>> backend.list", the backend is reported as healthy. Plus, there's no
>> issues with varnish communicating with the backend when I visit the
>> backend host from within the varnish virtual machine. Everything works
>> as intended when I run a web client (curl or lynx) from the varnish vm
>> terminal. The problem is varnish doesn't communicate with the backend
>> when I visit the backend host from outside the vm on my host computer's
>> web browser.
>>
>>
>> The setup is is this - two virtual machines running in vagrant and
>> virtualbox
>>
>>
>> 192.168.33.26 (apache box with hostname clas-test.myhost.pvt listening
>> on port 84)
>>
>> 192.168.33.27 (clas-varnish.myhost.pvt)
>>
>>
>> From default.vcl:
>>
>>
>> vcl 4.0;
>> import std;
>> import directors;
>>
>> include "backends.vcl";
>>
>> sub vcl_init {
>>
>> new local_test = directors.round_robin();
>> local_test.add_backend(express_test);
>> }
>> sub vcl_recv {
>>
>> if (server.hostname == "clas-test.hostname.pvt") {
>> set req.backend_hint = local_test.backend();
>> }
>> }
>> sub vcl_deliver {
>> if (obj.hits > 0) {
>> set resp.http.X-Cache = "HIT";
>> std.log("hitmiss:HIT");
>> } else {
>> set resp.http.X-Cache = "MISS";
>> std.log("hitmiss:MISS");
>> }
>> }
>>
>> From backends.vcl:
>>
>>
>> backend express_test {
>> .host = "192.168.33.26"; #ip of my host in its own virtual machine
>> .port = "84"; #port I have set in the virtual host on my host's
>> virtual machine
>> }
>>
>> In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to
>> port 80 and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set
>> the address to my backend ip, varnish won't start and I get this error:
>>
>> bind(): Cannot assign requested address
>> [19743]: Error: Failed to open (any) accept sockets.
>>
>> And yet when I run "varnishadm backend.list" with the listen address
>> commented out, the backend is reported as healthy.
>>
>> Thanks again, all
>>
>>
>>
>> ------------------------------------------------------------------------
>> *From:* varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org
>> <varnish-misc-bounces+tim.stalker=ucdenver.edu@varnish-cache.org> on
>> behalf of Andreas Plesner <apj@mutt.dk>
>> *Sent:* Friday, January 20, 2017 2:59:10 AM
>> *To:* varnish-misc@varnish-cache.org
>> *Subject:* Re: Varnish on stand-alone server
>>
>> On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
>>> Varnish is aware of the backend I have set and works fine as long as I'm
>>> logged into its virtual machine and run either curl or lynx to the address of
>>> the machine with apache running. I have my /etc/hosts file set with the
>>> backend address and virtual host as configured in the apache box, but it
>>> seems that varnish ignores the /etc/hosts file. I get logging and see the
>>> headers when I run curl -I
>>> http://backend.vhost.name<http://backend.vhost.name/> but when I do the same
>>> thing via the browser, curl, or lynx on my host computer, no logging, nothing
>>> happens inside the varnish vm.
>>
>> You're not giving us any info that actually enables us to help you. What
>> doesn't work? What error messages do you get? What did you already try? What
>> were the results of these attempts? What is in the log?
>>
>> Most important is:
>>
>> What doesn't work? You've only stated that it doesn't work, not what is
>> actually happening when you've determined that it doesn't work.
>>
>> --
>> Andreas
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc@varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc@varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>


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