1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397
|
.\" Man page generated from reStructuredText.
.
.TH VCL 7 "" "" ""
.SH NAME
VCL \- Varnish Configuration Language
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.SH DESCRIPTION
.sp
The VCL language is a small domain\-specific language designed to be
used to describe request handling and document caching policies for
Varnish Cache.
.sp
When a new configuration is loaded, the varnishd management process
translates the VCL code to C and compiles it to a shared object which
is then loaded into the server process.
.sp
This document focuses on the syntax of the VCL language. For a full
description of syntax and semantics, with ample examples, please see
the online documentation at \fI\%https://www.varnish\-cache.org/docs/\fP .
.sp
Starting with Varnish 4.0, each VCL file must start by declaring its
version with \fBvcl\fP \fI<major>.<minor>\fP\fB;\fP marker at the top of
the file. See more about this under Versioning below.
.SS Operators
.sp
The following operators are available in VCL:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fB=\fP
Assignment operator.
.TP
.B \fB+=\fP, \fB\-=\fP, \fB*=\fP, \fB/=\fP
Assign and increment/decrement/multiply/divide operator.
.sp
For strings, \fB+=\fP appends.
.TP
.B \fB==\fP, \fB!=\fP, \fB<\fP, \fB>\fP, \fB<=\fP, \fB>=\fP
Comparisons
.TP
.B \fB~\fP, \fB!~\fP
Match / non\-match. Can either be used with regular expressions or ACLs.
.TP
.B \fB!\fP
Negation.
.TP
.B \fB&&\fP / \fB||\fP
Logical and/or.
.UNINDENT
.UNINDENT
.UNINDENT
.SS Conditionals
.sp
VCL has \fBif\fP and \fBelse\fP statements. Nested logic can be
implemented with the \fBelseif\fP statement (\fBelsif\fP/\fBelif\fP/\fBelse if\fP are equivalent).
.sp
Note that there are no loops or iterators of any kind in VCL.
.SS Strings, booleans, time, duration, integers and real numbers
.sp
These are the data types in Varnish. You can \fBset\fP or \fBunset\fP these.
.sp
Example:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
set req.http.User\-Agent = "unknown";
unset req.http.Range;
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Strings
.sp
Basic strings are enclosed in double quotes \fB"\fP\fI\&...\fP\fB"\fP, and
may not contain newlines. Long strings are enclosed in
\fB{"\fP\fI\&...\fP\fB"}\fP\&. They may contain any character including single
double quotes \fB"\fP, newline and other control characters except for the
\fINUL\fP (0x00) character.
.SS Booleans
.sp
Booleans can be either \fBtrue\fP or \fBfalse\fP\&. In addition, in a boolean
context some data types will evaluate to \fBtrue\fP or \fBfalse\fP depending on
their value.
.sp
String types will evaluate to \fBfalse\fP if they are unset. This allows
checks of the type \fBif (req.http.opthdr) {}\fP to test if a header
exists, even if it is empty, whereas \fBif (req.http.opthdr == "") {}\fP
does not distinguish if the header does not exist or if it is empty.
.sp
Backend types
will evaluate to \fBfalse\fP if they don\(aqt have a backend assigned; integer
types will evaluate to \fBfalse\fP if their value is zero; duration types
will evaluate to \fBfalse\fP if their value is equal or less than zero.
.SS Time
.sp
VCL has time. A duration can be added to a time to make another time.
In string context they return a formatted string in RFC1123 format,
e.g. \fBSun, 06 Nov 1994 08:49:37 GMT\fP\&.
.sp
The keyword \fBnow\fP returns a notion of the current time, which is
kept consistent during VCL subroutine invocations, so during the
execution of a VCL state subroutine (\fBvcl_* {}\fP), including all
user\-defined subroutines being called, \fBnow\fP always returns the
same value.
.SS Durations
.sp
Durations are defined by a number followed by a unit. The number can
include a fractional part, e.g. \fB1.5s\fP\&. The supported units are:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fBms\fP
milliseconds
.TP
.B \fBs\fP
seconds
.TP
.B \fBm\fP
minutes
.TP
.B \fBh\fP
hours
.TP
.B \fBd\fP
days
.TP
.B \fBw\fP
weeks
.TP
.B \fBy\fP
years
.UNINDENT
.UNINDENT
.UNINDENT
.sp
In string context they return a string with their value rounded to
3 decimal places and excluding the unit, e.g. \fB1.500\fP\&.
.SS Integers
.sp
Certain fields are integers, used as expected. In string context they
return a string, e.g. \fB1234\fP\&.
.SS Real numbers
.sp
VCL understands real numbers. In string context they return a string
with their value rounded to 3 decimal places, e.g. \fB3.142\fP\&.
.SS Regular Expressions
.sp
Varnish uses Perl\-compatible regular expressions (PCRE). For a
complete description please see the pcre(3) man page.
.sp
To send flags to the PCRE engine, such as to do case insensitive matching, add
the flag within parens following a question mark, like this:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
# If host is NOT example dot com..
if (req.http.host !~ "(?i)example\e.com$") {
...
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Include statement
.sp
To include a VCL file in another file use the include keyword:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
include "foo.vcl";
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Import statement
.sp
The \fBimport\fP statement is used to load Varnish Modules (VMODs.)
.sp
Example:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
import std;
sub vcl_recv {
std.log("foo");
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Comments
.sp
Single lines of VCL can be commented out using \fB//\fP or
\fB#\fP\&. Multi\-line blocks can be commented out with
\fB/*\fP\fIblock\fP\fB*/\fP\&.
.sp
Example:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
sub vcl_recv {
// Single line of out\-commented VCL.
# Another way of commenting out a single line.
/*
Multi\-line block of commented\-out VCL.
*/
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Backend definition
.sp
A backend declaration creates and initialises a named backend object. A
declaration start with the keyword \fBbackend\fP followed by the name of the
backend. The actual declaration is in curly brackets, in a key/value fashion.:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
backend name {
.attribute = "value";
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
One of the attributes \fB\&.host\fP or \fB\&.path\fP is mandatory (but not
both). The attributes will inherit their defaults from the global
parameters. The following attributes are available:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fB\&.host\fP
The host to be used. IP address or a hostname that resolves to a
single IP address. This attribute is mandatory, unless \fB\&.path\fP
is declared.
.UNINDENT
.sp
\fB\&.path\fP (\fBVCL >= 4.1\fP)
.INDENT 0.0
.INDENT 3.5
The absolute path of a Unix domain socket at which a backend is
listening. If the file at that path does not exist or is not
accessible to Varnish at VCL load time, then the VCL compiler
issues a warning, but does not fail. This makes it possible to
start the UDS\-listening peer, or set the socket file\(aqs
permissions, after starting Varnish or loading VCL with a UDS
backend. But the socket file must exist and have necessary
permissions before the first connection is attempted, otherwise
fetches will fail. If the file does exist and is accessible, then
it must be a socket; otherwise the VCL load fails. One of
\fB\&.path\fP or \fB\&.host\fP must be declared (but not both). \fB\&.path\fP
may only be used in VCL since version 4.1.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \fB\&.port\fP
The port on the backend that Varnish should connect to. Ignored if
a Unix domain socket is declared in \fB\&.path\fP\&.
.TP
.B \fB\&.host_header\fP
A host header to add to probes and regular backend requests if they have no
such header.
.TP
.B \fB\&.connect_timeout\fP
Timeout for connections.
.sp
Default: \fBconnect_timeout\fP parameter, see \fIvarnishd(1)\fP
.TP
.B \fB\&.first_byte_timeout\fP
Timeout for first byte.
.sp
Default: \fBfirst_byte_timeout\fP parameter, see \fIvarnishd(1)\fP
.TP
.B \fB\&.between_bytes_timeout\fP
Timeout between bytes.
.sp
Default: \fBbetween_bytes_timeout\fP parameter, see \fIvarnishd(1)\fP
.TP
.B \fB\&.probe\fP
Attach a probe to the backend. See \fI\%Probes\fP
.TP
.B \fB\&.proxy_header\fP
The PROXY protocol version Varnish should use when connecting to
this backend. Allowed values are \fB1\fP and \fB2\fP\&.
.sp
\fINotice\fP this setting will lead to backend connections being used
for a single request only (subject to future improvements). Thus,
extra care should be taken to avoid running into failing backend
connections with EADDRNOTAVAIL due to no local ports being
available. Possible options are:
.INDENT 7.0
.IP \(bu 2
Use additional backend connections to extra IP addresses or TCP
ports
.IP \(bu 2
Increase the number of available ports (Linux sysctl
\fBnet.ipv4.ip_local_port_range\fP)
.IP \(bu 2
Reuse backend connection ports early (Linux sysctl
\fBnet.ipv4.tcp_tw_reuse\fP)
.UNINDENT
.TP
.B \fB\&.max_connections\fP
Maximum number of open connections towards this backend. If
Varnish reaches the maximum Varnish it will start failing
connections.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
Empty backends can also be defined using the following syntax.:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
backend name none;
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
An empty backend will always return status code 503 as if it is sick.
.sp
Backends can be used with \fIdirectors\fP\&. Please see the
\fIvmod_directors(3)\fP man page for more information.
.SS Probes
.sp
Probes will query the backend for status on a regular basis and mark
the backend as down it they fail. A probe is defined as this:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
probe name {
.attribute = "value";
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
The probe named \fBdefault\fP is special and will be used for all backends
which do not explicitly reference a probe.
.sp
There are no mandatory options. These are the options you can set:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fB\&.url\fP
The URL to query. Defaults to \fB/\fP\&.
Mutually exclusive with \fB\&.request\fP
.TP
.B \fB\&.request\fP
Specify a full HTTP request using multiple strings. \fB\&.request\fP will
have \fB\er\en\fP automatically inserted after every string.
Mutually exclusive with \fB\&.url\fP\&.
.sp
\fINote\fP that probes require the backend to complete sending the
response and close the connection within the specified timeout, so
\fB\&.request\fP will, for \fBHTTP/1.1\fP, most likely need to contain a
\fB"Connection: close"\fP string.
.TP
.B \fB\&.expected_response\fP
The expected HTTP response code. Defaults to \fB200\fP\&.
.TP
.B \fB\&.timeout\fP
The timeout for the probe. Default is \fB2s\fP\&.
.TP
.B \fB\&.interval\fP
How often the probe is run. Default is \fB5s\fP\&.
.TP
.B \fB\&.initial\fP
How many of the polls in \fB\&.window\fP are considered good when Varnish
starts. Defaults to the value of \fB\&.threshold\fP \- 1. In this case, the
backend starts as sick and requires one single poll to be
considered healthy.
.TP
.B \fB\&.window\fP
How many of the latest polls we examine to determine backend health.
Defaults to \fB8\fP\&.
.TP
.B \fB\&.threshold\fP
How many of the polls in \fB\&.window\fP must have succeeded to
consider the backend to be healthy.
Defaults to \fB3\fP\&.
.UNINDENT
.UNINDENT
.UNINDENT
.SS Access Control List (ACL)
.sp
An Access Control List (ACL) declaration creates and initialises a named access
control list which can later be used to match client addresses:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
acl localnetwork {
"localhost"; # myself
"192.0.2.0"/24; # and everyone on the local network
! "192.0.2.23"; # except for the dial\-in router
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
If an ACL entry specifies a host name which Varnish is unable to
resolve, it will match any address it is compared to. Consequently,
if it is preceded by a negation mark, it will reject any address it is
compared to, which may not be what you intended. If the entry is
enclosed in parentheses, however, it will simply be ignored.
.sp
To match an IP address against an ACL, simply use the match operator:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
if (client.ip ~ localnetwork) {
return (pipe);
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS VCL objects
.sp
A VCL object can be instantiated with the \fBnew\fP keyword:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
sub vcl_init {
new b = directors.round_robin()
b.add_backend(node1);
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
This is only available in \fBvcl_init\fP\&.
.SS Subroutines
.sp
A subroutine is used to group code for legibility or reusability:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
sub pipe_if_local {
if (client.ip ~ localnetwork) {
return (pipe);
}
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Subroutines in VCL do not take arguments, nor do they return
values. The built in subroutines all have names beginning with \fBvcl_\fP,
which is reserved.
.sp
To call a subroutine, use the \fBcall\fP keyword followed by the
subroutine\(aqs name:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
sub vcl_recv {
call pipe_if_local;
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Return statements
.sp
The ongoing \fBvcl_*\fP subroutine execution ends when a
\fBreturn(\fP\fI<action>\fP\fB)\fP statement is made.
.sp
The \fI<action>\fP specifies how execution should proceed. The context
defines which actions are available.
.SS Multiple subroutines
.sp
If multiple subroutines with the name of one of the built\-in ones are defined,
they are concatenated in the order in which they appear in the source.
.sp
The built\-in VCL distributed with Varnish will be implicitly concatenated
when the VCL is compiled.
.SS VCL Variables
.sp
Variables provide read, write and delete access to almost all aspects
of the work at hand.
.sp
Reading a variable is done simply by using its name in VCL:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
if (client.ip ~ bad_guys) {
return (synth(400));
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Writing a variable, where this is possible, is done with a \fBset\fP
statement:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
set resp.http.never = "Let You Down";
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Similarly, deleting a variable, for the few variables where this is
possible, is done with a \fBunset\fP statement:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
unset req.http.cookie;
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Which operations are possible on each variable is described below,
often with the shorthand "backend" which covers the \fBvcl_backend_* {}\fP
subroutines and "client" which covers the rest, except \fBvcl_init {}\fP
and \fBvcl_fini {}\fP\&.
.sp
When setting a variable, the right hand side of the equal sign
must have the variables type, you cannot assign a STRING to
a variable of type NUMBER, even if the string is \fB"42"\fP\&.
(Explicit conversion functions can be found in
\fIvmod_std(3)\fP).
.SS local, server, remote and client
.sp
These variables describe the network connection between the
client and varnishd.
.sp
Without PROXY protocol:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
client server
remote local
v v
CLIENT \-\-\-\-\-\-\-\-\-\-\-\- VARNISHD
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
With PROXY protocol:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
client server remote local
v v v v
CLIENT \-\-\-\-\-\-\-\-\-\-\-\- PROXY \-\-\-\-\-\-\-\-\-\-\-\- VARNISHD
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
local.ip
.INDENT 0.0
.INDENT 3.5
Type: IP
.sp
Readable from: client, backend
.sp
The IP address (and port number) of the local end of the
TCP connection, for instance \fB192.168.1.1:81\fP
.sp
If the connection is a UNIX domain socket, the value
will be \fB0.0.0.0:0\fP
.UNINDENT
.UNINDENT
.sp
local.endpoint \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client, backend
.sp
The address of the \(aq\-a\(aq socket the session was accepted on.
.sp
If the argument was \fB\-a foo=:81\fP this would be ":81"
.UNINDENT
.UNINDENT
.sp
local.socket \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client, backend
.sp
The name of the \(aq\-a\(aq socket the session was accepted on.
.sp
If the argument was \fB\-a foo=:81\fP this would be "foo".
.sp
Note that all \(aq\-a\(aq gets a default name on the form \fBa%d\fP
if no name is provided.
.UNINDENT
.UNINDENT
.sp
remote.ip
.INDENT 0.0
.INDENT 3.5
Type: IP
.sp
Readable from: client, backend
.sp
The IP address of the other end of the TCP connection.
This can either be the clients IP, or the outgoing IP
of a proxy server.
.sp
If the connection is a UNIX domain socket, the value
will be \fB0.0.0.0:0\fP
.UNINDENT
.UNINDENT
.sp
client.ip
.INDENT 0.0
.INDENT 3.5
Type: IP
.sp
Readable from: client, backend
.sp
The client\(aqs IP address, either the same as \fBremote.ip\fP
or what the PROXY protocol told us.
.UNINDENT
.UNINDENT
.sp
client.identity
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
Writable from: client
.sp
Identification of the client, used to load balance
in the client director. Defaults to \fBclient.ip\fP
.sp
This variable can be overwritten with more precise
information, for instance extracted from a \fBCookie:\fP
header.
.UNINDENT
.UNINDENT
.sp
server.ip
.INDENT 0.0
.INDENT 3.5
Type: IP
.sp
Readable from: client, backend
.sp
The IP address of the socket on which the client
connection was received, either the same as \fBserver.ip\fP
or what the PROXY protocol told us.
.UNINDENT
.UNINDENT
.sp
server.hostname
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: all
.sp
The host name of the server, as returned by the
\fIgethostname(3)\fP system function.
.UNINDENT
.UNINDENT
.sp
server.identity
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: all
.sp
The identity of the server, as set by the \fB\-i\fP parameter.
.sp
If an \fB\-i\fP parameter is not passed to varnishd, the return
value from \fIgethostname(3)\fP system function will be used.
.UNINDENT
.UNINDENT
.SS req and req_top
.sp
These variables describe the present request, and when ESI:include
requests are being processed, req_top points to the request received
from the client.
.sp
req
.INDENT 0.0
.INDENT 3.5
Type: HTTP
.sp
Readable from: client
.sp
The entire request HTTP data structure.
Mostly useful for passing to VMODs.
.UNINDENT
.UNINDENT
.sp
req.method
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
Writable from: client
.sp
The request method (e.g. "GET", "HEAD", ...)
.UNINDENT
.UNINDENT
.sp
req.hash
.INDENT 0.0
.INDENT 3.5
Type: BLOB
.sp
Readable from: vcl_hit, vcl_miss, vcl_pass, vcl_purge, vcl_deliver
.sp
The hash key of this request.
Mostly useful for passing to VMODs, but can also be useful
for debugging hit/miss status.
.UNINDENT
.UNINDENT
.sp
req.url
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
Writable from: client
.sp
The requested URL, for instance "/robots.txt".
.UNINDENT
.UNINDENT
.sp
req.proto \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
Writable from: client
.sp
The HTTP protocol version used by the client, usually "HTTP/1.1"
or "HTTP/2.0".
.UNINDENT
.UNINDENT
.sp
req.proto \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
The HTTP protocol version used by the client, usually "HTTP/1.1"
or "HTTP/2.0".
.UNINDENT
.UNINDENT
.sp
req.http.*
.INDENT 0.0
.INDENT 3.5
Type: HEADER
.sp
Readable from: client
.sp
Writable from: client
.sp
Unsetable from: client
.sp
The headers of request, things like \fBreq.http.date\fP\&.
.sp
The RFCs allow multiple headers with the same name, and both
\fBset\fP and \fBunset\fP will remove \fIall\fP headers with the name given.
.UNINDENT
.UNINDENT
.sp
req.restarts
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: client
.sp
A count of how many times this request has been restarted.
.UNINDENT
.UNINDENT
.sp
req.storage
.INDENT 0.0
.INDENT 3.5
Type: STEVEDORE
.sp
Readable from: client
.sp
Writable from: client
.sp
The storage backend to use to save this request body.
.UNINDENT
.UNINDENT
.sp
req.esi_level
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: client
.sp
A count of how many levels of ESI requests we\(aqre currently at.
.UNINDENT
.UNINDENT
.sp
req.ttl
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: client
.sp
Writable from: client
.sp
Upper limit on the object age for cache lookups to return hit.
.UNINDENT
.UNINDENT
.sp
req.grace
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: client
.sp
Writable from: client
.sp
Upper limit on the object grace.
.sp
During lookup the minimum of req.grace and the object\(aqs stored
grace value will be used as the object\(aqs grace.
.UNINDENT
.UNINDENT
.sp
req.xid
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
Unique ID of this request.
.UNINDENT
.UNINDENT
.sp
req.esi \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client
.sp
Writable from: client
.sp
Set to \fBfalse\fP to disable ESI processing
regardless of any value in beresp.do_esi. Defaults
to \fBtrue\fP\&. This variable is replaced by \fBresp.do_esi\fP
in VCL 4.1.
.UNINDENT
.UNINDENT
.sp
req.can_gzip
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client
.sp
True if the client provided \fBgzip\fP or \fBx\-gzip\fP in the
\fBAccept\-Encoding\fP header.
.UNINDENT
.UNINDENT
.sp
req.backend_hint
.INDENT 0.0
.INDENT 3.5
Type: BACKEND
.sp
Readable from: client
.sp
Writable from: client
.sp
Set bereq.backend to this if we attempt to fetch.
When set to a director, reading this variable returns
an actual backend if the director has resolved immediately,
or the director otherwise.
When used in string context, returns the name of the director
or backend, respectively.
.UNINDENT
.UNINDENT
.sp
req.hash_ignore_busy
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client
.sp
Writable from: client
.sp
Default: \fBfalse\fP\&.
.sp
Ignore any busy object during cache lookup.
.sp
You only want to do this when you have two server looking
up content sideways from each other to avoid deadlocks.
.UNINDENT
.UNINDENT
.sp
req.hash_always_miss
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client
.sp
Writable from: client
.sp
Default: \fBfalse\fP\&.
.sp
Force a cache miss for this request, even if perfectly
good matching objects are in the cache.
.sp
This is useful to force\-update the cache without invalidating
existing entries in case the fetch fails.
.UNINDENT
.UNINDENT
.sp
req.is_hitmiss
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client
.sp
If this request resulted in a hitmiss
.UNINDENT
.UNINDENT
.sp
req.is_hitpass
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client
.sp
If this request resulted in a hitpass
.UNINDENT
.UNINDENT
.sp
req_top.method
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
The request method of the top\-level request in a tree
of ESI requests. (e.g. "GET", "HEAD").
Identical to req.method in non\-ESI requests.
.UNINDENT
.UNINDENT
.sp
req_top.url
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
The requested URL of the top\-level request in a tree
of ESI requests.
Identical to req.url in non\-ESI requests.
.UNINDENT
.UNINDENT
.sp
req_top.http.*
.INDENT 0.0
.INDENT 3.5
Type: HEADER
.sp
Readable from: client
.sp
HTTP headers of the top\-level request in a tree of ESI requests.
Identical to req.http. in non\-ESI requests.
.UNINDENT
.UNINDENT
.sp
req_top.proto
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client
.sp
HTTP protocol version of the top\-level request in a tree of
ESI requests.
Identical to req.proto in non\-ESI requests.
.UNINDENT
.UNINDENT
.SS bereq
.sp
This is the request we send to the backend, it is built from the
clients \fBreq.*\fP fields by filtering out "per\-hop" fields which
should not be passed along (\fBConnection:\fP, \fBRange:\fP and similar).
.sp
Slightly more fields are allowed through for \fBpass\(ga fetches
than for \(gamiss\(ga fetches, for instance \(ga\(gaRange\fP\&.
.sp
bereq
.INDENT 0.0
.INDENT 3.5
Type: HTTP
.sp
Readable from: backend
.sp
The entire backend request HTTP data structure.
Mostly useful as argument to VMODs.
.UNINDENT
.UNINDENT
.sp
bereq.xid
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: backend
.sp
Unique ID of this request.
.UNINDENT
.UNINDENT
.sp
bereq.retries
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: backend
.sp
A count of how many times this request has been retried.
.UNINDENT
.UNINDENT
.sp
bereq.backend
.INDENT 0.0
.INDENT 3.5
Type: BACKEND
.sp
Readable from: vcl_pipe, backend
.sp
Writable from: vcl_pipe, backend
.sp
This is the backend or director we attempt to fetch from.
When set to a director, reading this variable returns
an actual backend if the director has resolved immediately,
or the director otherwise.
When used in string context, returns the name of the director
or backend, respectively.
.UNINDENT
.UNINDENT
.sp
bereq.body
.INDENT 0.0
.INDENT 3.5
Type: BODY
.sp
Unsetable from: vcl_backend_fetch
.sp
The request body.
.sp
Unset will also remove \fBbereq.http.Content\-Length\fP\&.
.UNINDENT
.UNINDENT
.sp
bereq.hash
.INDENT 0.0
.INDENT 3.5
Type: BLOB
.sp
Readable from: vcl_pipe, backend
.sp
The hash key of this request, a copy of \fBreq.hash\fP\&.
.UNINDENT
.UNINDENT
.sp
bereq.method
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_pipe, backend
.sp
Writable from: vcl_pipe, backend
.sp
The request type (e.g. "GET", "HEAD").
.sp
Regular (non\-pipe, non\-pass) fetches are always "GET"
.UNINDENT
.UNINDENT
.sp
bereq.url
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_pipe, backend
.sp
Writable from: vcl_pipe, backend
.sp
The requested URL, copied from \fBreq.url\fP
.UNINDENT
.UNINDENT
.sp
bereq.proto \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_pipe, backend
.sp
Writable from: vcl_pipe, backend
.sp
The HTTP protocol version, "HTTP/1.1" unless a pass or pipe
request has "HTTP/1.0" in \fBreq.proto\fP
.UNINDENT
.UNINDENT
.sp
bereq.proto \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_pipe, backend
.sp
The HTTP protocol version, "HTTP/1.1" unless a pass or pipe
request has "HTTP/1.0" in \fBreq.proto\fP
.UNINDENT
.UNINDENT
.sp
bereq.http.*
.INDENT 0.0
.INDENT 3.5
Type: HEADER
.sp
Readable from: vcl_pipe, backend
.sp
Writable from: vcl_pipe, backend
.sp
Unsetable from: vcl_pipe, backend
.sp
The headers to be sent to the backend.
.UNINDENT
.UNINDENT
.sp
bereq.uncacheable
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: backend
.sp
Indicates whether this request is uncacheable due to a
\fIpass\fP in the client side or a hit on an hit\-for\-pass object.
.UNINDENT
.UNINDENT
.sp
bereq.connect_timeout
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_pipe, backend
.sp
Writable from: vcl_pipe, backend
.sp
Default: \fB\&.connect_timeout\fP attribute from the
\fIbackend_definition\fP, which defaults to the
\fBconnect_timeout\fP parameter, see \fIvarnishd(1)\fP\&.
.sp
The time in seconds to wait for a backend connection to be
established.
.UNINDENT
.UNINDENT
.sp
bereq.first_byte_timeout
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: backend
.sp
Writable from: backend
.sp
Default: \fB\&.first_byte_timeout\fP attribute from the
\fIbackend_definition\fP, which defaults to the
\fBfirst_byte_timeout\fP parameter, see \fIvarnishd(1)\fP\&.
.sp
The time in seconds to wait getting the first byte back
from the backend. Not available in pipe mode.
.UNINDENT
.UNINDENT
.sp
bereq.between_bytes_timeout
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: backend
.sp
Writable from: backend
.sp
Default: \fB\&.between_bytes_timeout\fP attribute from the
\fIbackend_definition\fP, which defaults to the
\fBbetween_bytes_timeout\fP parameter, see \fIvarnishd(1)\fP\&.
.sp
The time in seconds to wait between each received byte from the
backend. Not available in pipe mode.
.UNINDENT
.UNINDENT
.sp
bereq.is_bgfetch
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: backend
.sp
True for fetches where the client got a hit on an object in
grace, and this fetch was kicked of in the background to get
a fresh copy.
.UNINDENT
.UNINDENT
.SS beresp
.sp
The response received from the backend, one cache misses, the
store object is built from \fBberesp\fP\&.
.sp
beresp
.INDENT 0.0
.INDENT 3.5
Type: HTTP
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
The entire backend response HTTP data structure, useful as
argument to VMOD functions.
.UNINDENT
.UNINDENT
.sp
beresp.body
.INDENT 0.0
.INDENT 3.5
Type: BODY
.sp
Writable from: vcl_backend_error
.sp
For producing a synthetic body.
.UNINDENT
.UNINDENT
.sp
beresp.proto \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
The HTTP protocol version the backend replied with.
.UNINDENT
.UNINDENT
.sp
beresp.proto \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
The HTTP protocol version the backend replied with.
.UNINDENT
.UNINDENT
.sp
beresp.status
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
The HTTP status code returned by the server.
.sp
More information in the \fI\%HTTP response status\fP section.
.UNINDENT
.UNINDENT
.sp
beresp.reason
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
The HTTP status message returned by the server.
.UNINDENT
.UNINDENT
.sp
beresp.http.*
.INDENT 0.0
.INDENT 3.5
Type: HEADER
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Unsetable from: vcl_backend_response, vcl_backend_error
.sp
The HTTP headers returned from the server.
.UNINDENT
.UNINDENT
.sp
beresp.do_esi
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: \fBfalse\fP\&.
.sp
Set it to true to parse the object for ESI directives.
Will only be honored if req.esi is true.
.sp
It is a VCL error to use beresp.do_esi after setting beresp.filters.
.UNINDENT
.UNINDENT
.sp
beresp.do_stream
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: \fBtrue\fP\&.
.sp
Deliver the object to the client while fetching the whole
object into varnish.
.sp
For uncacheable objects, storage for parts of the body which
have been sent to the client may get freed early, depending
on the storage engine used.
.sp
This variable has no effect if do_esi is true or when the
response body is empty.
.UNINDENT
.UNINDENT
.sp
beresp.do_gzip
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: \fBfalse\fP\&.
.sp
Set to \fBtrue\fP to gzip the object while storing it.
.sp
If \fBhttp_gzip_support\fP is disabled, setting this variable
has no effect.
.sp
It is a VCL error to use beresp.do_gzip after setting beresp.filters.
.UNINDENT
.UNINDENT
.sp
beresp.do_gunzip
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: \fBfalse\fP\&.
.sp
Set to \fBtrue\fP to gunzip the object while storing it in the
cache.
.sp
If \fBhttp_gzip_support\fP is disabled, setting this variable
has no effect.
.sp
It is a VCL error to use beresp.do_gunzip after setting beresp.filters.
.UNINDENT
.UNINDENT
.sp
beresp.was_304
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
When \fBtrue\fP this indicates that we got a 304 response
to our conditional fetch from the backend and turned
that into \fBberesp.status = 200\fP
.UNINDENT
.UNINDENT
.sp
beresp.uncacheable
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Inherited from bereq.uncacheable, see there.
.sp
Setting this variable makes the object uncacheable.
.sp
This may may produce a hit\-for\-miss object in the cache.
.sp
Clearing the variable has no effect and will log the warning
"Ignoring attempt to reset beresp.uncacheable".
.UNINDENT
.UNINDENT
.sp
beresp.ttl
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: Cache\-Control \fBs\-maxage\fP or \fBmax\-age\fP directives,
or a value computed from the Expires header\(aqs deadline, or the
\fBdefault_ttl\fP parameter.
.sp
The object\(aqs remaining time to live, in seconds.
.UNINDENT
.UNINDENT
.sp
beresp.age
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Default: Age header, or zero.
.sp
The age of the object.
.UNINDENT
.UNINDENT
.sp
beresp.grace
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: Cache\-Control \fBstale\-while\-revalidate\fP directive,
or \fBdefault_grace\fP parameter.
.sp
Set to a period to enable grace.
.UNINDENT
.UNINDENT
.sp
beresp.keep
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Default: \fBdefault_keep\fP parameter.
.sp
Set to a period to enable conditional backend requests.
.sp
The keep time is cache lifetime in addition to the ttl.
.sp
Objects with ttl expired but with keep time left may be used
to issue conditional (If\-Modified\-Since / If\-None\-Match)
requests to the backend to refresh them.
.UNINDENT
.UNINDENT
.sp
beresp.backend
.INDENT 0.0
.INDENT 3.5
Type: BACKEND
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
This is the backend we fetched from. If bereq.backend
was set to a director, this will be the backend selected
by the director.
When used in string context, returns its name.
.UNINDENT
.UNINDENT
.sp
beresp.backend.name
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Name of the backend this response was fetched from.
Same as beresp.backend.
.UNINDENT
.UNINDENT
.sp
beresp.backend.ip \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: IP
.sp
Readable from: vcl_backend_response
.sp
IP of the backend this response was fetched from.
.UNINDENT
.UNINDENT
.sp
beresp.storage
.INDENT 0.0
.INDENT 3.5
Type: STEVEDORE
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
The storage backend to use to save this object.
.UNINDENT
.UNINDENT
.sp
beresp.storage_hint \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_backend_response, vcl_backend_error
.sp
Writable from: vcl_backend_response, vcl_backend_error
.sp
Deprecated since varnish 5.1 and discontinued since VCL
4.1 (varnish 6.0). Use beresp.storage instead.
.sp
Hint to Varnish that you want to save this object to a
particular storage backend.
.UNINDENT
.UNINDENT
.sp
beresp.filters
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_backend_response
.sp
Writable from: vcl_backend_response
.sp
List of Varnish Fetch Processor (VFP) filters the beresp.body
will be pulled through. The order left to right signifies
processing from backend to cache, iow the leftmost filter is
run first on the body as received from the backend after
decoding of any transfer encodings.
.sp
VFP Filters change the body before going into the cache and/or
being handed to the client side, where it may get processed
again by resp.filters.
.sp
The following VFP filters exist in varnish\-cache:
.INDENT 0.0
.IP \(bu 2
\fBgzip\fP: compress a body using gzip
.IP \(bu 2
\fBtestgunzip\fP: Test if a body is valid gzip and refuse it
otherwise
.IP \(bu 2
\fBgunzip\fP: Uncompress gzip content
.IP \(bu 2
\fBesi\fP: ESI\-process plain text content
.IP \(bu 2
\fBesi_gzip\fP: Save gzipped snippets for efficient
ESI\-processing
.sp
This filter enables stitching together ESI from individually
gzipped fragments, saving processing power for
re\-compression on the client side at the expense of some
compression efficiency.
.UNINDENT
.sp
Additional VFP filters are available from VMODs.
.sp
By default, beresp.filters is constructed as follows:
.INDENT 0.0
.IP \(bu 2
\fBgunzip\fP gets added for gzipped content if
\fBberesp.do_gunzip\fP or \fBberesp.do_esi\fP are true.
.IP \(bu 2
\fBesi_gzip\fP gets added if \fBberesp.do_esi\fP is true
together with \fBberesp.do_gzip\fP or content is already
compressed.
.IP \(bu 2
\fBesi\fP gets added if \fBberesp.do_esi\fP is true
.IP \(bu 2
\fBgzip\fP gets added for uncompressed content if
\fBberesp.do_gzip\fP is true
.IP \(bu 2
\fBtestgunzip\fP gets added for compressed content if
\fBberesp.do_gunzip\fP is false.
.UNINDENT
.sp
After beresp.filters is set, using any of the beforementioned
\fBberesp.do_*\fP switches is a VCL error.
.UNINDENT
.UNINDENT
.SS obj
.sp
This is the object we found in cache. It cannot be modified.
.sp
obj.proto
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_hit
.sp
The HTTP protocol version stored in the object.
.UNINDENT
.UNINDENT
.sp
obj.status
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: vcl_hit
.sp
The HTTP status code stored in the object.
.sp
More information in the \fI\%HTTP response status\fP section.
.UNINDENT
.UNINDENT
.sp
obj.reason
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_hit
.sp
The HTTP reason phrase stored in the object.
.UNINDENT
.UNINDENT
.sp
obj.hits
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: vcl_hit, vcl_deliver
.sp
The count of cache\-hits on this object.
.sp
In \fIvcl_deliver\fP a value of 0 indicates a cache miss.
.UNINDENT
.UNINDENT
.sp
obj.http.*
.INDENT 0.0
.INDENT 3.5
Type: HEADER
.sp
Readable from: vcl_hit
.sp
The HTTP headers stored in the object.
.UNINDENT
.UNINDENT
.sp
obj.ttl
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_hit, vcl_deliver
.sp
The object\(aqs remaining time to live, in seconds.
.UNINDENT
.UNINDENT
.sp
obj.age
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_hit, vcl_deliver
.sp
The age of the object.
.UNINDENT
.UNINDENT
.sp
obj.grace
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_hit, vcl_deliver
.sp
The object\(aqs grace period in seconds.
.UNINDENT
.UNINDENT
.sp
obj.keep
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: vcl_hit, vcl_deliver
.sp
The object\(aqs keep period in seconds.
.UNINDENT
.UNINDENT
.sp
obj.uncacheable
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_deliver
.sp
Whether the object is uncacheable (pass, hit\-for\-pass or
hit\-for\-miss).
.UNINDENT
.UNINDENT
.sp
obj.storage
.INDENT 0.0
.INDENT 3.5
Type: STEVEDORE
.sp
Readable from: vcl_hit, vcl_deliver
.sp
The storage backend where this object is stored.
.UNINDENT
.UNINDENT
.sp
obj.can_esi
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_hit, vcl_deliver
.sp
If the object can be ESI processed, that is if setting
\fBresp.do_esi\fP or adding \fBesi\fP to \fBresp.filters\fP in
\fBvcl_deliver {}\fP would cause the response body to be ESI
processed.
.UNINDENT
.UNINDENT
.SS resp
.sp
This is the response we send to the client, it is built from either
\fBberesp\fP (pass/miss), \fBobj\fP (hits) or created from whole cloth (synth).
.sp
With the exception of \fBresp.body\fP all \fBresp.*\fP variables available
in both \fBvcl_deliver{}\fP and \fBvcl_synth{}\fP as a matter of symmetry.
.sp
resp
.INDENT 0.0
.INDENT 3.5
Type: HTTP
.sp
Readable from: vcl_deliver, vcl_synth
.sp
The entire response HTTP data structure, useful as argument
to VMODs.
.UNINDENT
.UNINDENT
.sp
resp.body
.INDENT 0.0
.INDENT 3.5
Type: BODY
.sp
Writable from: vcl_synth
.sp
To produce a synthetic response body, for instance for errors.
.UNINDENT
.UNINDENT
.sp
resp.proto \fBVCL <= 4.0\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
The HTTP protocol version to use for the response.
.UNINDENT
.UNINDENT
.sp
resp.proto \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
The HTTP protocol version to use for the response.
.UNINDENT
.UNINDENT
.sp
resp.status
.INDENT 0.0
.INDENT 3.5
Type: INT
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
The HTTP status code that will be returned.
.sp
More information in the \fI\%HTTP response status\fP section.
.sp
resp.status 200 will get changed into 304 by core code after
a return(deliver) from vcl_deliver for conditional requests
to cached content if validation succeeds.
.sp
For the validation, first \fBreq.http.If\-None\-Match\fP is
compared against \fBresp.http.Etag\fP\&. If they compare equal
according to the rules for weak validation (see RFC7232), a
304 is sent.
.sp
Secondly, \fBreq.http.If\-Modified\-Since\fP is compared against
\fBresp.http.Last\-Modified\fP or, if it is unset, against the
point in time when the object was last modified based on the
\fBDate\fP and \fBAge\fP headers received with the backend
response which created the object. If the object has not been
modified based on that comparison, a 304 is sent.
.UNINDENT
.UNINDENT
.sp
resp.reason
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
The HTTP status message that will be returned.
.UNINDENT
.UNINDENT
.sp
resp.http.*
.INDENT 0.0
.INDENT 3.5
Type: HEADER
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
Unsetable from: vcl_deliver, vcl_synth
.sp
The HTTP headers that will be returned.
.UNINDENT
.UNINDENT
.\" XXX does vcl_synth make any sense?
.
.sp
resp.do_esi \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
Default: obj.can_esi
.sp
This can be used to selectively disable ESI processing,
even though ESI parsing happened during fetch.
This is useful when Varnish caches peer with each other.
.sp
It is a VCL error to use resp.do_esi after setting resp.filters.
.UNINDENT
.UNINDENT
.sp
resp.is_streaming
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Returns true when the response will be streamed
while being fetched from the backend.
.UNINDENT
.UNINDENT
.sp
resp.filters
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: vcl_deliver, vcl_synth
.sp
Writable from: vcl_deliver, vcl_synth
.sp
List of VDP filters the resp.body will be pushed through.
.sp
Before resp.filters is set, the value read will be the default
filter list as determined by varnish based on resp.do_esi and
request headers.
.sp
After resp.filters is set, changing any of the conditions
which otherwise determine the filter selection will have no
effiect. Using resp.do_esi is an error once resp.filters is
set.
.UNINDENT
.UNINDENT
.SS Special variables
.sp
now
.INDENT 0.0
.INDENT 3.5
Type: TIME
.sp
Readable from: all
.sp
The current time, in seconds since the UNIX epoch.
.sp
When converted to STRING in expressions it returns
a formatted timestamp like \fBTue, 20 Feb 2018 09:30:31 GMT\fP
.UNINDENT
.UNINDENT
.SS sess
.sp
A session corresponds to the "conversation" that Varnish has with a
single client connection, over which one or more request/response
transactions may take place. It may comprise the traffic over an
HTTP/1 keep\-alive connection, or the multiplexed traffic over an
HTTP/2 connection.
.sp
sess.xid \fBVCL >= 4.1\fP
.INDENT 0.0
.INDENT 3.5
Type: STRING
.sp
Readable from: client, backend
.sp
Unique ID of this session.
.UNINDENT
.UNINDENT
.sp
sess.timeout_idle
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: client
.sp
Writable from: client
.sp
Idle timeout for this session, defaults to the
\fBtimeout_idle\fP parameter, see \fIvarnishd(1)\fP
.UNINDENT
.UNINDENT
.sp
sess.timeout_linger
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: client
.sp
Writable from: client
.sp
Linger timeout for this session, defaults to the
\fBtimeout_linger\fP parameter, see \fIvarnishd(1)\fP
.UNINDENT
.UNINDENT
.sp
sess.send_timeout
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: client
.sp
Writable from: client
.sp
Total timeout for ordinary HTTP1 responses, defaults to the
\fBsend_timeout\fP parameter, see \fIvarnishd(1)\fP
.UNINDENT
.UNINDENT
.sp
sess.idle_send_timeout
.INDENT 0.0
.INDENT 3.5
Type: DURATION
.sp
Readable from: client
.sp
Writable from: client
.sp
Send timeout for individual pieces of data on client
connections, defaults to the \fBidle_send_timeout\fP parameter,
see \fIvarnishd(1)\fP
.UNINDENT
.UNINDENT
.SS storage
.sp
storage.<name>.free_space
.INDENT 0.0
.INDENT 3.5
Type: BYTES
.sp
Readable from: client, backend
.sp
Free space available in the named stevedore. Only available for
the malloc stevedore.
.UNINDENT
.UNINDENT
.sp
storage.<name>.used_space
.INDENT 0.0
.INDENT 3.5
Type: BYTES
.sp
Readable from: client, backend
.sp
Used space in the named stevedore. Only available for the malloc
stevedore.
.UNINDENT
.UNINDENT
.sp
storage.<name>.happy
.INDENT 0.0
.INDENT 3.5
Type: BOOL
.sp
Readable from: client, backend
.sp
Health status for the named stevedore. Not available in any of the
current stevedores.
.UNINDENT
.UNINDENT
.SS HTTP response status
.sp
A status code normally has 3 digits XYZ where X must be between 1 and 5
included. Since it is not uncommon to see HTTP clients or servers relying
on non\-standard or even invalid status codes Varnish tolerates any status
between 100 and 999.
.sp
With VCL code it is possible to use status codes in the form XXYZZ where the
overall value is lower than 65536 and the Y digit is between 1 and 9 included.
Only the YZZ part is sent to the client.
.sp
The XXYZZ form of status codes can be set on \fBresp.status\fP and
\fBberesp.status\fP or passed via \fBreturn(synth(...))\fP and
\fBreturn(error(...))\fP transitions.
.sp
XX can be therefore be used to pass information around inside VCL, for
instance \fBreturn(synth(22404))\fP from \fBvcl_recv{}\fP to \fBvcl_synth{}\fP\&.
.sp
The \fBobj.status\fP variable will inherit the XXYZZ form, but in a ban
expresion only the YZZ part will be available. The XXYZZ form is strictly
limited to VCL execution.
.sp
Assigning an HTTP standardized code to \fBresp.status\fP or \fBberesp.status\fP
will also set \fBresp.reason\fP or \fBberesp.reason\fP to the corresponding
status message.
.SS Functions
.sp
The following built\-in functions are available:
.SS ban(STRING)
.INDENT 0.0
.INDENT 3.5
Invalidates all objects in cache that match the given expression with the
ban mechanism.
.sp
The format of \fISTRING\fP is:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
<field> <operator> <arg> [&& <field> <oper> <arg> ...]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP \(bu 2
\fI<field>\fP:
.INDENT 2.0
.IP \(bu 2
string fields:
.INDENT 2.0
.IP \(bu 2
\fBreq.url\fP: The request url
.IP \(bu 2
\fBreq.http.*\fP: Any request header
.IP \(bu 2
\fBobj.status\fP: The cache object status
.IP \(bu 2
\fBobj.http.*\fP: Any cache object header
.UNINDENT
.sp
\fBobj.status\fP is treated as a string despite the fact that it
is actually an integer.
.IP \(bu 2
duration fields:
.INDENT 2.0
.IP \(bu 2
\fBobj.ttl\fP: Remaining ttl at the time the ban is issued
.IP \(bu 2
\fBobj.age\fP: Object age at the time the ban is issued
.IP \(bu 2
\fBobj.grace\fP: The grace time of the object
.IP \(bu 2
\fBobj.keep\fP: The keep time of the object
.UNINDENT
.UNINDENT
.IP \(bu 2
\fI<operator>\fP:
.INDENT 2.0
.IP \(bu 2
for all fields:
.INDENT 2.0
.IP \(bu 2
\fB==\fP: \fI<field>\fP and \fI<arg>\fP are equal
.IP \(bu 2
\fB!=\fP: \fI<field>\fP and \fI<arg>\fP are unequal
.UNINDENT
.sp
strings are compared case sensitively
.IP \(bu 2
for string fields:
.INDENT 2.0
.IP \(bu 2
\fB~\fP: \fI<field>\fP matches the regular expression \fI<arg>\fP
.IP \(bu 2
\fB!~\fP:\fI<field>\fP does not match the regular expression \fI<arg>\fP
.UNINDENT
.IP \(bu 2
for duration fields:
.INDENT 2.0
.IP \(bu 2
\fB>\fP: \fI<field>\fP is greater than \fI<arg>\fP
.IP \(bu 2
\fB>=\fP: \fI<field>\fP is greater than or equal to \fI<arg>\fP
.IP \(bu 2
\fB<\fP: \fI<field>\fP is less than \fI<arg>\fP
.IP \(bu 2
\fB<=\fP: \fI<field>\fP is less than or equal to \fI<arg>\fP
.UNINDENT
.UNINDENT
.IP \(bu 2
\fI<arg>\fP:
.INDENT 2.0
.IP \(bu 2
for string fields:
.sp
Either a literal string or a regular expression. Note that
\fI<arg>\fP does not use any of the string delimiters like \fB"\fP or
\fB{"\fP\fI\&...\fP\fB"}\fP used elsewhere in varnish. To match
against strings containing whitespace, regular expressions
containing \fB\es\fP can be used.
.IP \(bu 2
for duration fields:
.sp
A VCL duration like \fB10s\fP, \fB5m\fP or \fB1h\fP, see \fI\%Durations\fP
.UNINDENT
.UNINDENT
.sp
Expressions can be chained using the \fIand\fP operator \fB&&\fP\&. For \fIor\fP
semantics, use several bans.
.sp
The unset \fI<field>\fP is not equal to any string, such that, for a
non\-existing header, the operators \fB==\fP and \fB~\fP always evaluate
as false, while the operators \fB!=\fP and \fB!~\fP always evaluate as
true, respectively, for any value of \fI<arg>\fP\&.
.UNINDENT
.UNINDENT
.SS hash_data(input)
.INDENT 0.0
.INDENT 3.5
Adds an input to the hash input. In the built\-in VCL \fBhash_data()\fP
is called on the host and URL of the request. Available in \fBvcl_hash\fP\&.
.UNINDENT
.UNINDENT
.SS synthetic(STRING)
.INDENT 0.0
.INDENT 3.5
Prepare a synthetic response body containing the \fISTRING\fP\&. Available
in \fBvcl_synth\fP and \fBvcl_backend_error\fP\&.
.sp
Identical to \fBset resp.body\fP / \fBset beresp.body\fP\&.
.UNINDENT
.UNINDENT
.\" list above comes from struct action_table[] in vcc_action.c.
.
.SS regsub(str, regex, sub)
.INDENT 0.0
.INDENT 3.5
Returns a copy of \fIstr\fP with the first occurrence of the regular
expression \fIregex\fP replaced with \fIsub\fP\&. Within \fIsub\fP, \fB\e0\fP (which
can also be spelled \fB\e&\fP) is replaced with the entire matched
string, and \fB\e\fP\fIn\fP is replaced with the contents of subgroup \fIn\fP
in the matched string.
.UNINDENT
.UNINDENT
.SS regsuball(str, regex, sub)
.INDENT 0.0
.INDENT 3.5
As \fBregsub()\fP, but this replaces all occurrences.
.UNINDENT
.UNINDENT
.\" regsub* is in vcc_expr.c
.
.sp
For converting or casting VCL values between data types use the functions
available in the std VMOD.
.SH VERSIONING
.sp
Multiple versions of the VCL syntax can coexist within certain
constraints.
.sp
The VCL syntax version at the start of VCL file specified with \fB\-f\fP
sets the hard limit that cannot be exceeded anywhere, and it selects
the appropriate version of the builtin VCL.
.sp
That means that you can never include \fBvcl 9.1;\fP from \fBvcl 8.7;\fP,
but the opposite \fImay\fP be possible, to the extent the compiler
supports it.
.sp
Files pulled in via \fBinclude\fP do not need to have a
\fBvcl\fP \fIX.Y\fP\fB;\fP but it may be a good idea to do it anyway, to
not have surprises in the future. The syntax version set in an
included file only applies to that file and any files it includes \-
unless these set their own VCL syntax version.
.sp
The version of Varnish this file belongs to supports syntax 4.0 and 4.1.
.SH EXAMPLES
.sp
For examples, please see the online documentation.
.SH SEE ALSO
.INDENT 0.0
.IP \(bu 2
\fIvarnishd(1)\fP
.IP \(bu 2
\fIvmod_directors(3)\fP
.IP \(bu 2
\fIvmod_std(3)\fP
.UNINDENT
.SH HISTORY
.sp
VCL was developed by Poul\-Henning Kamp in cooperation with Verdens
Gang AS, Redpill Linpro and Varnish Software. This manual page is
written by Per Buer, Poul\-Henning Kamp, Martin Blix Grydeland,
Kristian Lyngstøl, Lasse Karstensen and possibly others.
.SH COPYRIGHT
.sp
This document is licensed under the same license as Varnish
itself. See LICENSE for details.
.INDENT 0.0
.IP \(bu 2
Copyright (c) 2006 Verdens Gang AS
.IP \(bu 2
Copyright (c) 2006\-2015 Varnish Software AS
.UNINDENT
.\" Generated by docutils manpage writer.
.
|