Re: auto reply 200 on stats URL just for logs
On Tue, Jul 12, 2011 at 03:16:54PM +0200, Damien Hardy wrote: > I have done some tests. > The errorfile 503 directive on empty backend do the job from the client > point of view but to be very perfect I would like there is no 503 error code > in my haproxy logs. OK I see. You want something even uglier ? Chain a normal backend in front of a monitor-uri : frontend XXX use_backend ret200 if { url_beg /test } ... backend ret200 server 127.0.0.1:1 frontend monitor bind :127.0.0.1:1 monitor-uri / That way your "ret200" backend will forward to the "monitor" frontend and will log the 200. Quite dirty but it will do the job :-) Regards, Willy
Re: auto reply 200 on stats URL just for logs
2011/7/12 Willy Tarreau > On Tue, Jul 12, 2011 at 10:42:31AM +0200, Damien Hardy wrote: > > 2011/7/12 Willy Tarreau > > > > > > > > Then you can use the errorfile method : you send your request to a > > > backend without any server (which will produce an error 503) and you > > > use "errorfile 503 /path/to/file" to return this file instead of the > > > error 503. Some people use this to serve a few static files. > > > > > > > If it reply 200 it could be the good thing > > The file is HTTP and not HTML, so you put the status code you want in > it with whatever header you like. > > > > > Maybe haproxy could send the well know tiny "transparent pixel" on > > > > demand without even go through caching servers. #featurerequest :) > > > > > > I'm not sure what well known method you're speaking about. However, > > > the "return" feature is planned in the roadmap in order to be able > > > to return static contents or a specific file. It's just not implemented > > > yet. > > > > > > > This is exactly the feature I was thinking (transparent pixel is a > classic > > small resources used to make design fit well or getting some stats via > logs > > like google analitics or xity tags) > > called with an html img tag it works even when javascript is disabled :) > > OK I did not understand you were talking about that. > > Regards, > Willy > > I have done some tests. The errorfile 503 directive on empty backend do the job from the client point of view but to be very perfect I would like there is no 503 error code in my haproxy logs. Jul 12 15:11:41 ip6-localhost haproxy[16185]: 10.147.28.20:49423[12/Jul/2011:15:11:41.362] varnish tag/ 0/-1/-1/-1/0 503 190 - - SC-- 0/0/0/0/0 0/0 {vhost||Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0} "GET /stat?action=view&resources=123+456+789(&session=423)(&user=p...@gmail.com) HTTP/1.1" Thank you, Waiting for the "return" feature. Regards, -- Damien
Re: auto reply 200 on stats URL just for logs
On Tue, Jul 12, 2011 at 10:42:31AM +0200, Damien Hardy wrote: > 2011/7/12 Willy Tarreau > > > > > Then you can use the errorfile method : you send your request to a > > backend without any server (which will produce an error 503) and you > > use "errorfile 503 /path/to/file" to return this file instead of the > > error 503. Some people use this to serve a few static files. > > > > If it reply 200 it could be the good thing The file is HTTP and not HTML, so you put the status code you want in it with whatever header you like. > > > Maybe haproxy could send the well know tiny "transparent pixel" on > > > demand without even go through caching servers. #featurerequest :) > > > > I'm not sure what well known method you're speaking about. However, > > the "return" feature is planned in the roadmap in order to be able > > to return static contents or a specific file. It's just not implemented > > yet. > > > > This is exactly the feature I was thinking (transparent pixel is a classic > small resources used to make design fit well or getting some stats via logs > like google analitics or xity tags) > called with an html img tag it works even when javascript is disabled :) OK I did not understand you were talking about that. Regards, Willy
Re: auto reply 200 on stats URL just for logs
2011/7/12 Willy Tarreau > > Then you can use the errorfile method : you send your request to a > backend without any server (which will produce an error 503) and you > use "errorfile 503 /path/to/file" to return this file instead of the > error 503. Some people use this to serve a few static files. > If it reply 200 it could be the good thing > > > Maybe haproxy could send the well know tiny "transparent pixel" on > > demand without even go through caching servers. #featurerequest :) > > I'm not sure what well known method you're speaking about. However, > the "return" feature is planned in the roadmap in order to be able > to return static contents or a specific file. It's just not implemented > yet. > This is exactly the feature I was thinking (transparent pixel is a classic small resources used to make design fit well or getting some stats via logs like google analitics or xity tags) called with an html img tag it works even when javascript is disabled :) Cdt, -- Damien
Re: auto reply 200 on stats URL just for logs
On Tue, Jul 12, 2011 at 08:56:12AM +0200, Damien Hardy wrote: > >frontend XXX > >mode http > >monitor-uri /test > > > > All checks to /test will return a 200 OK. Its used so that haproxy can be > > tested by other components (eg: keepalived). > > > > Regards, > > Willy > > > > Yes but if I refer to the doc there is no log entries when someone > request monitor uri and this is what à want for my stats platform. Then you can use the errorfile method : you send your request to a backend without any server (which will produce an error 503) and you use "errorfile 503 /path/to/file" to return this file instead of the error 503. Some people use this to serve a few static files. > Maybe haproxy could send the well know tiny "transparent pixel" on > demand without even go through caching servers. #featurerequest :) I'm not sure what well known method you're speaking about. However, the "return" feature is planned in the roadmap in order to be able to return static contents or a specific file. It's just not implemented yet. Regards, Willy
Re: auto reply 200 on stats URL just for logs
Le 11/07/2011 22:07, Willy Tarreau a écrit : > On Mon, Jul 11, 2011 at 02:20:37PM +0200, Damien Hardy wrote: >> Whatever method is used, I want that haproxy never ask to any backend an >> answer directly to client and log the request like others > > Then define a "monitor-uri", it's done for that. > > Example : > >frontend XXX >mode http >monitor-uri /test > > All checks to /test will return a 200 OK. Its used so that haproxy can be > tested by other components (eg: keepalived). > > Regards, > Willy > Yes but if I refer to the doc there is no log entries when someone request monitor uri and this is what à want for my stats platform. Maybe haproxy could send the well know tiny "transparent pixel" on demand without even go through caching servers. #featurerequest :) Regards, -- Damien
Re: auto reply 200 on stats URL just for logs
On Mon, Jul 11, 2011 at 02:20:37PM +0200, Damien Hardy wrote: > Whatever method is used, I want that haproxy never ask to any backend an > answer directly to client and log the request like others Then define a "monitor-uri", it's done for that. Example : frontend XXX mode http monitor-uri /test All checks to /test will return a 200 OK. Its used so that haproxy can be tested by other components (eg: keepalived). Regards, Willy
Re: auto reply 200 on stats URL just for logs
Whatever method is used, I want that haproxy never ask to any backend an answer directly to client and log the request like others best regards, -- Damien 2011/7/11 Baptiste > hi, > > There is a HTTP method for that: HEAD. > > cheers > > On Mon, Jul 11, 2011 at 11:21 AM, Damien Hardy > wrote: > > I have to precise that this is not related to the "stats" delivered by > > haproxy but a static resource used on our pages to get counters based on > > access logs provide by haproxy. > > > > 2011/7/11 Damien Hardy > >> > >> Hello, > >> > >> I want haproxy to reply 200 with no data on a predefined URL without > going > >> through backends just for getting logs with referrer for our stats > platform. > >> > >> Is there a way to do that with haproxy directives (redirect with code > 200 > >> maybe) ? > >> > >> Best regards, > >> > >> -- > >> Damien > > > > >
Re: auto reply 200 on stats URL just for logs
hi, There is a HTTP method for that: HEAD. cheers On Mon, Jul 11, 2011 at 11:21 AM, Damien Hardy wrote: > I have to precise that this is not related to the "stats" delivered by > haproxy but a static resource used on our pages to get counters based on > access logs provide by haproxy. > > 2011/7/11 Damien Hardy >> >> Hello, >> >> I want haproxy to reply 200 with no data on a predefined URL without going >> through backends just for getting logs with referrer for our stats platform. >> >> Is there a way to do that with haproxy directives (redirect with code 200 >> maybe) ? >> >> Best regards, >> >> -- >> Damien > >
Re: auto reply 200 on stats URL just for logs
I have to precise that this is not related to the "stats" delivered by haproxy but a static resource used on our pages to get counters based on access logs provide by haproxy. 2011/7/11 Damien Hardy > Hello, > > I want haproxy to reply 200 with no data on a predefined URL without going > through backends just for getting logs with referrer for our stats platform. > > Is there a way to do that with haproxy directives (redirect with code 200 > maybe) ? > > Best regards, > > -- > Damien >
auto reply 200 on stats URL just for logs
Hello, I want haproxy to reply 200 with no data on a predefined URL without going through backends just for getting logs with referrer for our stats platform. Is there a way to do that with haproxy directives (redirect with code 200 maybe) ? Best regards, -- Damien