Mailing List Archive

only cache Get and Head
I wanted to know what is the correct syntax to only want to cache Get and Head if req.method. I used this and O got and error when I checked the syntax.

If (req.method ! = "GET" && req.method ! = "HEAD") {
Return (pass);
}

Does this need to inserted in a particular place


This email (including any attachments) may contain confidential information intended solely for acknowledged recipients. If you think you have received this information in error, please reply to the sender and delete all copies from your system. Please note that unauthorized use, disclosure, or further distribution of this information is prohibited by the sender. Note also that we may monitor email directed to or originating from our network. Thank you for your consideration and assistance. |
Re: only cache Get and Head [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/17/2017 06:22 PM, Rodney Bizzell wrote:
> I wanted to know what is the correct syntax to only want to cache
> Get and Head if req.method. I used this and O got and error when I
> checked the syntax.
>
> If (req.method ! = ?GET? && req.method ! = ?HEAD?) {
>
> Return (pass);
>
> }

The "if" and "return" keywords are all lower-case.

If there's a syntax error, you get an error message from the VCL
compiler. The messages are not always very explanatory, but mostly
they are, and you should always send along the contents of the error
message when you're asking for help. (You might find that it explains
the problem well enough that you don't have to ask in the first place.)

Also: this exact code is in builtin.vcl for vcl_recv (of course with
the correct syntax for the keywords). Can you just let your own
vcl_recv drop into the built-in version? If your own VCL subroutines
end at any point without calling return(), then Varnish goes on to
execute the built-in version. If you can let that happen, then you
don't need to do this yourself at all. If this is *only* thing you
want in vcl_recv, then you don't need to write your own vcl_recv, just
let builtin.vcl do the job.


HTH,
Geoff
- --
** * * UPLEX - Nils Goroll Systemoptimierung

Scheffelstra?e 32
22301 Hamburg

Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753

http://uplex.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYzB9zAAoJEOUwvh9pJNURYD4P/3CNzqUv0Xs4+RIDrO/7raPo
Oi9+BHSdbZoFLtzo1YXtm2AKiyPj64KnrGmj6s/rJqTlbkJF8rDXpCY5M4onF93a
y0knZP5O30Sn/8gSkH8ClcRtN0qIuj87KoukrEetvN3TC/TWKa8ibBS/zcJSjv7L
d5nmz4RQD3kuBNVfuEy5ALFTdzOw+G/C+ORynE1TTg0DUNr+PZIXCpRytsXy3HKe
4bIpIaWTZS167TgFpIK4nZTA5ZriXGJj8yK9BU0m21SONxKLm6T4M2PZi3N2OJ/J
Bot2UAhXzf8onIf98JM+yhd7C8hBSajvpxAusb3vms/bKDhxOpvbXUZSkeUfBMsv
mXfDPM/MKB5T9NPPH21wwmdS+ZyiKCd7XBjRkKBxHlhocSr/9eweGcnJCGDTe+GN
yDlWbYX9rOpGwcCo+5P2HXHO/qRTo8xKjkAgXAxNDDUeNwp19GLd2dvCN0/mSrb7
LAjuBuVYdWqavJRv0y/17zdwD2blG6k6Bxa10xzpEGj64s+fS077f3YcOLq0lZbA
Ux3rd0T7mKYwK8UofVtftmPsrxkJ3VPPh24gjWR1tPpy0Sss6qo92pzMWyK2lOey
BQqZ+FuNFOtb7H0cPDqB73m/xGYVe1X7wG5Pj4ZzR6GSS/mfw2iXKWWMYK1J4GsH
Pk6XzObDga+mHW5lHsF1
=NOFE
-----END PGP SIGNATURE-----

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