Re: cant get restart; to fetch and deliver from other backend on HTTP error

2009-09-04 Thread Kristian Lyngstol
On Thu, Sep 03, 2009 at 03:25:32PM +0200, Gerald Leier wrote:
> On Thu, 2009-09-03 at 11:00 +0200, Kristian Lyngstol wrote: 
> > On Thu, Aug 27, 2009 at 04:29:13PM +0200, Gerald Leier wrote:
> > >
> > > After setting up 2 servers(one returning the requested page
> > > the other returning 500 errors) i tested a bit but i have
> > > some bug in there i cant get a grip on.

(snip snip)

All I can say is that your VCL looks sane. I'm not ruling out that Varnish
might be a factor here, but I'd have to play with the setup a bit to see
what happens. Perhaps a packet capture between the varnish server and test
backends could reveal what's going on?

-- 
Kristian Lyngstøl
Redpill Linpro AS
Tlf: +47 21544179
Mob: +47 99014497


pgp6KzykrqfCD.pgp
Description: PGP signature
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: cant get restart; to fetch and deliver from other backend on HTTP error

2009-09-03 Thread Gerald Leier
hi,


On Thu, 2009-09-03 at 11:00 +0200, Kristian Lyngstol wrote: 
> On Thu, Aug 27, 2009 at 04:29:13PM +0200, Gerald Leier wrote:
> > After setting up 2 servers(one returning the requested page
> > the other returning 500 errors) i tested a bit but i have
> > some bug in there i cant get a grip on.
> > 
> > after the first node returns a http 500 error varnish continues with
> > the second nodehere is the part where it stops doing what i want:
> 
> (...)
> > 11 TxHeader b X-Forwarded-For: 10.21.1.40
> > 11 BackendClose b test2
> > 10 VCL_call c error
> (...)
> 
> If the connection failed, like it seems to have done here, you do not end
> up in VCL fetch. Note how varnish doesn't receive any headers from the web
> server (no RxHeader for the second backend).
> 
> Varnish is unable to connect properly to your second server and that's
> what's causing problems.
> 
well if varnish connects to the "HTTP 1.x 200 OK" server
first it has no problem what so ever delivering the result.

but if it hits a 500 firstwell.

im pretty shure that its my vcl configs that are buggy
and that this has nothing to do with the backend.

but anyways. i am out of cloues, so ill setup another testsystem
to validate the results i got out of the primary testsetup.


gerald




> Varnishstat will probably reveal backend failures.
> 
-- 

___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: cant get restart; to fetch and deliver from other backend on HTTP error

2009-09-03 Thread Kristian Lyngstol
On Thu, Aug 27, 2009 at 04:29:13PM +0200, Gerald Leier wrote:
> After setting up 2 servers(one returning the requested page
> the other returning 500 errors) i tested a bit but i have
> some bug in there i cant get a grip on.
> 
> after the first node returns a http 500 error varnish continues with
> the second nodehere is the part where it stops doing what i want:

(...)
> 11 TxHeader b X-Forwarded-For: 10.21.1.40
> 11 BackendClose b test2
> 10 VCL_call c error
(...)

If the connection failed, like it seems to have done here, you do not end
up in VCL fetch. Note how varnish doesn't receive any headers from the web
server (no RxHeader for the second backend).

Varnish is unable to connect properly to your second server and that's
what's causing problems.

Varnishstat will probably reveal backend failures.

-- 
Kristian Lyngstøl
Redpill Linpro AS
Tlf: +47 21544179
Mob: +47 99014497


pgp9IS7cm68en.pgp
Description: PGP signature
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


cant get restart; to fetch and deliver from other backend on HTTP error

2009-08-27 Thread Gerald Leier
hello,

I want to use varnish to "hide" HTTP 50x codes.
As far as i understood this is done in the "sub vcl_fetch"

After setting up 2 servers(one returning the requested page
the other returning 500 errors) i tested a bit but i have
some bug in there i cant get a grip on.

after the first node returns a http 500 error varnish continues with
the second nodehere is the part where it stops doing what i want:

.
10 VCL_return   c restart
10 VCL_call c recv
10 VCL_return   c pass
10 VCL_call c pass
10 VCL_return   c pass
11 BackendOpen  b test2 10.10.1.1 51154 10.10.1.50 38080
10 Backend  c 11 www_director test2
11 TxRequestb POST
11 TxURLb /testservice
11 TxProtocol   b HTTP/1.1
11 TxHeader b User-Agent: curl
11 TxHeader b Host: 10.10.1.1:38080
11 TxHeader b Accept: */*
11 TxHeader b Content-Type: text/xml;charset=UTF-8
11 TxHeader b Content-Length: 326
11 TxHeader b X-Varnish: 614647428
11 TxHeader b X-Forwarded-For: 10.21.1.40
11 BackendClose b test2
10 VCL_call c error
10 VCL_return   c deliver
.


has anyone a hint on what i am doing wrong?

thanks
 gerald


.

./varnishd -f ../etc/varnish/testing.vcl -a 10.10.1.1:38080

../etc/varnish/testing.vcl:

backend test1 {
.host = "10.10.1.50";
.port = "38080";
}

backend test2 {
.host = "10.10.1.60";
.port = "38080";
}

director www_director round-robin {
{ .backend = test1; }
{ .backend = test2; }
}

sub vcl_recv {
# Force lookup if the request is a no-cache request from the client
if (req.http.Cache-Control ~ "no-cache") { purge_url(req.url); }
if (req.restarts == 0) {
set req.backend = www_director;
} else {
set req.backend = www_director;
}
if (req.request != "GET" && req.request != "HEAD") {
/* We only deal with GET and HEAD by default */
 return (pass);
}
if (req.http.Authorization || req.http.Cookie) {
/* Not cacheable by default */
 return (pass);
}
# set an artificial header to pass on the true client IP address
remove req.http.X-Varnish-Client-IP;
setreq.http.X-Varnish-Client-IP = client.ip;
}

sub vcl_fetch {
if (obj.status == 500 || obj.status == 503 || obj.status == 504) {
restart;
}
}

sub vcl_deliver {
# hide existence of this proxy server
remove resp.http.X-Varnish;
remove resp.http.Via;
deliver;
}


log:

10 SessionOpen  c 10.21.1.40 7984 10.10.1.1:38080
10 ReqStart c 10.21.1.40 7984 614647428
10 RxRequestc POST
10 RxURLc /testservice
10 RxProtocol   c HTTP/1.1
10 RxHeader c User-Agent: curl
10 RxHeader c Host: 10.10.1.1:38080
10 RxHeader c Accept: */*
10 RxHeader c Content-Type: text/xml;charset=UTF-8
10 RxHeader c Content-Length: 326
10 VCL_call c recv
10 VCL_return   c pass
10 VCL_call c pass
10 VCL_return   c pass
11 BackendOpen  b test1 10.10.1.1 60016 10.10.1.60 38080
10 Backend  c 11 www_director test1
11 TxRequestb POST
11 TxURLb /testservice
11 TxProtocol   b HTTP/1.1
11 TxHeader b User-Agent: curl
11 TxHeader b Host: 10.10.1.1:38080
11 TxHeader b Accept: */*
11 TxHeader b Content-Type: text/xml;charset=UTF-8
11 TxHeader b Content-Length: 326
11 TxHeader b X-Varnish: 614647428
11 TxHeader b X-Forwarded-For: 10.21.1.40
0 CLI  - Rd ping
0 CLI  - Wr 0 200 PONG 1251380397 1.0
0 CLI  - Rd ping
0 CLI  - Wr 0 200 PONG 1251380400 1.0
11 RxProtocol   b HTTP/1.1
11 RxStatus b 500
11 RxResponse   b Internal Server Error
11 RxHeader b X-Powered-By: Servlet/2.5
11 RxHeader b Server: Sun GlassFish Enterprise Server
11 RxHeader b Content-Type: text/xml;charset="utf-8"
11 RxHeader b Transfer-Encoding: chunked
11 RxHeader b Date: Thu, 27 Aug 2009 13:39:56 GMT
11 RxHeader b Connection: close
10 ObjProtocol  c HTTP/1.1
10 ObjStatusc 500
10 ObjResponse  c Internal Server Error
10 ObjHeaderc X-Powered-By: Servlet/2.5
10 ObjHeaderc Server: Sun GlassFish Enterprise Server
10 ObjHeaderc Content-Type: text/xml;charset="utf-8"
10 ObjHeaderc Date: Thu, 27 Aug 2009 13:39:56 GMT
11 BackendClose b test1
10 TTL  c 614647428 RFC 120 1251380396 0 0 0 0
10 VCL_call c fetch
10 VCL_return   c restart
10 VCL_call c recv
10 VCL_return   c pass
10 VCL_call c pass
10 VCL_return   c pass
11 BackendOpen  b test2 10.10.1.1 51154 10.10.1.50 38080
10 Backend  c 11 www_director test2
11 TxRequestb POST
11 TxURLb /testservice
11 TxProtocol   b HTTP/1.1
11 TxHeader b User-Agent: curl
11 TxHeader b Host: 10.10.1.1:38080
11 TxHeader b Accept: */*
11 TxHeader b Content-Type: text/xml;charset=UTF-8
11 TxHeader b Content-Length: 326
11 TxHeader b X-Varnish: 614647428
11 TxHead