Correct way to raise immediate error in VCL
Paul A. Procacci
pprocacci at datapipe.com
Thu Mar 8 07:37:16 CET 2012
I don't know the answer to your question as I'm still using the latest varnish 2.x in production,
but you can see exactly what your vcl produces by `varnish -C -f /path/to/vcl_file`.
Hope that helps.
~Paul
On Wed, Mar 07, 2012 at 02:48:23PM +0000, George wrote:
> 3.0 Docs state that from vcl_recv "The vcl_recv subroutine may terminate
> with calling return() on one of the following keywords:" ... error code
> [reason]. This implies a syntax of return( error 404 "Not Found" ); -
> which I believe is incorrect and didn't work when I tried it. There are
> a number of examples of throwing errors - usually something like error
> 404 "Not Found" that I know work .
>
> However, I can find no definitive statement that this method causes an
> IMMEDIATE return from vcl_recv. The reason I need clarification is that
> I am tracking an issue that seems to indicate that processing continues
> after an error is called and am seeing urls appearing in the backend
> server logs that indicate subsequent pipe commands may have been honored
> despite the error call.
>
> Could someone clarify - is calling error 404 "Not Found"; sufficient to
> cause all further processing to cease and a subroutine return to be
> implicitly carried out - or is something more specific required like..
>
> (VCL Snippit)
>
> #block unauthorized access to this site
> if (!client.ip ~ authorized) {
> error 404 "Not Found.";
> return (error);
> }
>
>
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
________________________________
This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See http://www.datapipe.com/legal/email_disclaimer/ for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.
More information about the varnish-misc
mailing list