Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
95dfe7f0
Commit
95dfe7f0
authored
Feb 16, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add VCL design pattern about resp.status and modulus operator.
parent
6d15fe03
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
dp_vcl_resp_status.rst
doc/sphinx/reference/dp_vcl_resp_status.rst
+22
-0
index.rst
doc/sphinx/reference/index.rst
+1
-0
No files found.
doc/sphinx/reference/dp_vcl_resp_status.rst
0 → 100644
View file @
95dfe7f0
.. _dp_vcl_resp_status:
Using extra digits in resp.status
=================================
In Varnish the ``.status`` variables can hold more than three
digits, which is useful to send information to ``vcl_synth{}``
about which error message to produce::
sub vcl_recv {
if ([...]) {
return(synth(12404));
}
}
sub vcl_synth {
if (resp.status == 12404) {
[...] // this specific 404
} else if (resp.status % 1000 == 404) {
[...] // all other 404's
}
}
doc/sphinx/reference/index.rst
View file @
95dfe7f0
...
...
@@ -23,6 +23,7 @@ VCL Design Patterns
:maxdepth: 1
dp_vcl_recv_hash.rst
dp_vcl_resp_status.rst
Bundled VMODs
-------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment