Mailing List Archive

Custom error message
How can I customize the error messages that Varnish return?

I often recieve a 503 Service Unavailable because my Apache/PHP webserver
segfaults (probably because of the PHP op-code caching).

I don't want my users to see the default 503 error message with a link to
Varnish. They believe that is something they need to install to see my page.


--
Knut-Olav Hoven
Systemutvikler mob: +47 986 71 700
Linpro AS http://www.linpro.no/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.linpro.no/pipermail/varnish-misc/attachments/20070813/e28ffe94/attachment.pgp
Custom error message [ In reply to ]
Knut-Olav Hoven <hovenko at linpro.no> writes:
> How can I customize the error messages that Varnish return?

Not easily; edit bin/varnishd/cache_synthetic.c and recompile.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
Custom error message [ In reply to ]
On Monday 13 August 2007 12:11:47 Dag-Erling Sm?rgrav wrote:
> Knut-Olav Hoven <hovenko at linpro.no> writes:
> > How can I customize the error messages that Varnish return?
>
> Not easily; edit bin/varnishd/cache_synthetic.c and recompile.

Ok.

So I can't intercept the response in vcl, detect if the response code is 503
and then trigger a new 503 error with a different message or HTML code?



--
Knut-Olav Hoven
Systemutvikler mob: +47 986 71 700
Linpro AS http://www.linpro.no/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.linpro.no/pipermail/varnish-misc/attachments/20070813/558bd538/attachment.pgp
Custom error message [ In reply to ]
In message <200708131223.39508.hovenko at linpro.no>, Knut-Olav Hoven writes:

>On Monday 13 August 2007 12:11:47 Dag-Erling Sm=F8rgrav wrote:
>> Knut-Olav Hoven <hovenko at linpro.no> writes:
>> > How can I customize the error messages that Varnish return?
>>
>> Not easily; edit bin/varnishd/cache_synthetic.c and recompile.
>
>Ok.
>
>So I can't intercept the response in vcl, detect if the response code is 503
>and then trigger a new 503 error with a different message or HTML code?

You can change the status but not the HTML ... yet.

We have ideas for this area, basically, you would detect the 503,
edit req.url and restart the transaction with the new url.

Not yet implemented however.

We have also talked about being able to have local content on the
varnish server, likely in the form of a .tar file, but this is also
yet to be implemented.


--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Custom error message [ In reply to ]
You can always customize your apache error page.

Regards, Pablo

On 8/13/07, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> In message <200708131223.39508.hovenko at linpro.no>, Knut-Olav Hoven writes:
>
> >On Monday 13 August 2007 12:11:47 Dag-Erling Sm=F8rgrav wrote:
> >> Knut-Olav Hoven <hovenko at linpro.no> writes:
> >> > How can I customize the error messages that Varnish return?
> >>
> >> Not easily; edit bin/varnishd/cache_synthetic.c and recompile.
> >
> >Ok.
> >
> >So I can't intercept the response in vcl, detect if the response code is 503
> >and then trigger a new 503 error with a different message or HTML code?
>
> You can change the status but not the HTML ... yet.
>
> We have ideas for this area, basically, you would detect the 503,
> edit req.url and restart the transaction with the new url.
>
> Not yet implemented however.
>
> We have also talked about being able to have local content on the
> varnish server, likely in the form of a .tar file, but this is also
> yet to be implemented.
>
>
> --
> Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG | TCP/IP since RFC 956
> FreeBSD committer | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>
Custom error message [ In reply to ]
On Monday 13 August 2007 13:05:39 Pablo Garc?a wrote:
> You can always customize your apache error page.

No, I don't think I can, since PHP segfaults and takes Apache down with it.

>
> Regards, Pablo
>
> On 8/13/07, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> > In message <200708131223.39508.hovenko at linpro.no>, Knut-Olav Hoven writes:
> > >On Monday 13 August 2007 12:11:47 Dag-Erling Sm=F8rgrav wrote:
> > >> Knut-Olav Hoven <hovenko at linpro.no> writes:
> > >> > How can I customize the error messages that Varnish return?
> > >>
> > >> Not easily; edit bin/varnishd/cache_synthetic.c and recompile.
> > >
> > >Ok.
> > >
> > >So I can't intercept the response in vcl, detect if the response code is
> > > 503 and then trigger a new 503 error with a different message or HTML
> > > code?
> >
> > You can change the status but not the HTML ... yet.
> >
> > We have ideas for this area, basically, you would detect the 503,
> > edit req.url and restart the transaction with the new url.
> >
> > Not yet implemented however.
> >
> > We have also talked about being able to have local content on the
> > varnish server, likely in the form of a .tar file, but this is also
> > yet to be implemented.
> >
> >
> > --
> > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
> > phk at FreeBSD.ORG | TCP/IP since RFC 956
> > FreeBSD committer | BSD since 4.3-tahoe
> > Never attribute to malice what can adequately be explained by
> > incompetence. _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at projects.linpro.no
> > http://projects.linpro.no/mailman/listinfo/varnish-misc
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc



--
Knut-Olav Hoven
Systemutvikler mob: +47 986 71 700
Linpro AS http://www.linpro.no/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.linpro.no/pipermail/varnish-misc/attachments/20070813/ede7472d/attachment.pgp
Custom error message [ In reply to ]
Knut-Olav Hoven <hovenko at linpro.no> writes:
> Dag-Erling Sm?rgrav <des at linpro.no> writes:
> > Knut-Olav Hoven <hovenko at linpro.no> writes:
> > > How can I customize the error messages that Varnish return?
> > Not easily; edit bin/varnishd/cache_synthetic.c and recompile.
> So I can't intercept the response in vcl, detect if the response
> code is 503 and then trigger a new 503 error with a different
> message or HTML code?

It might be possible to change req.url and issue a restart? Poul-Henning?

Of course, if Apache is down and your error page isn't cached, you're SOL.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
Custom error message [ In reply to ]
On Monday 13 August 2007 16:03:39 Dag-Erling Sm?rgrav wrote:
> Knut-Olav Hoven <hovenko at linpro.no> writes:
> > Dag-Erling Sm?rgrav <des at linpro.no> writes:
> > > Knut-Olav Hoven <hovenko at linpro.no> writes:
> > > > How can I customize the error messages that Varnish return?
> > >
> > > Not easily; edit bin/varnishd/cache_synthetic.c and recompile.
> >
> > So I can't intercept the response in vcl, detect if the response
> > code is 503 and then trigger a new 503 error with a different
> > message or HTML code?
>
> It might be possible to change req.url and issue a restart? Poul-Henning?
>
> Of course, if Apache is down and your error page isn't cached, you're SOL.

If it is possible to issue a temporary redirect back to the user with a new
url, that could work for my case.

The error page can then be stored on a different webserver.

>
> DES



--
Knut-Olav Hoven
Systemutvikler mob: +47 986 71 700
Linpro AS http://www.linpro.no/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.linpro.no/pipermail/varnish-misc/attachments/20070813/c8372624/attachment.pgp
Custom error message [ In reply to ]
Knut-Olav Hoven <hovenko at linpro.no> writes:
> If it is possible to issue a temporary redirect back to the user with a new
> url, that could work for my case.

Conceptually, something like this should work:

vcl_fetch() {
if (!obj.valid) {
set obj.status = 304;
set obj.http.location = "http://error.example.com/php-sucks.html";
pass;
}
}

It probably doesn't, though, and there may even be cases where the
backend code issues an error page directly instead of passing control
to vcl_fetch(). This would make a good Junior Varnish Hacker
Project...

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no