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
8f3f5b57
Commit
8f3f5b57
authored
May 12, 2020
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Centralize the VCL status code documentation
parent
86032715
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
13 deletions
+30
-13
vcl_var.rst
doc/sphinx/reference/vcl_var.rst
+30
-13
No files found.
doc/sphinx/reference/vcl_var.rst
View file @
8f3f5b57
...
...
@@ -702,13 +702,7 @@ beresp.status
The HTTP status code returned by the server.
Status codes on the form XXYZZ can be set where
XXYZZ is less than 65536 and Y is [1...9].
Only YZZ will be sent back to clients.
XX can be therefore be used to pass information
around inside VCL, for instance ``return(synth(22404))``
from ``vcl_recv{}`` to ``vcl_synth{}``
More information in the `HTTP response status`_ section.
beresp.reason
...
...
@@ -1028,6 +1022,8 @@ obj.status
The HTTP status code stored in the object.
More information in the `HTTP response status`_ section.
obj.reason
...
...
@@ -1183,12 +1179,7 @@ resp.status
The HTTP status code that will be returned.
Assigning a HTTP standardized code to resp.status will also
set resp.reason to the corresponding status message.
Status codes on the form XXYZZ can be set where
XXYZZ is less than 65536 and Y is [1...9].
Only YZZ will be sent back to clients.
More information in the `HTTP response status`_ section.
resp.status 200 will get changed into 304 by core code after
a return(deliver) from vcl_deliver for conditional requests
...
...
@@ -1389,3 +1380,29 @@ storage.<name>.happy
Health status for the named stevedore. Not available in any of the
current stevedores.
HTTP response status
--------------------
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.
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.
The XXYZZ form of status codes can be set on ``resp.status`` and
``beresp.status`` or passed via ``return(synth(...))`` and
``return(error(...))`` transitions.
XX can be therefore be used to pass information around inside VCL, for
instance ``return(synth(22404))`` from ``vcl_recv{}`` to ``vcl_synth{}``.
The ``obj.status`` 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.
Assigning an HTTP standardized code to ``resp.status`` or ``beresp.status``
will also set ``resp.reason`` or ``beresp.reason`` to the corresponding
status message.
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