Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
homepage
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
homepage
Commits
dfed979e
Commit
dfed979e
authored
May 03, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "Tips" section. Contributions welcome.
parent
16fcf6ae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
7 deletions
+49
-7
phkbar.html
R1/source/_templates/phkbar.html
+12
-5
index.rst
R1/source/index.rst
+3
-2
index.rst
R1/source/tips/index.rst
+34
-0
No files found.
R1/source/_templates/phkbar.html
View file @
dfed979e
...
...
@@ -22,15 +22,22 @@
<a
href=
"/security/index.html"
>
Security
&
Advisories
</a>
</li>
<li
class=
"toctree-l1"
><a
href=
"/docs/index.html"
>
Documentation
</a></li>
<li
class=
"toctree-l2"
><a
href=
"/docs/trunk"
>
- trunk(5.0)
</a></li>
<li
class=
"toctree-l2"
><a
href=
"/docs/4.1"
>
- 4.1.x
</a></li>
<li
class=
"toctree-l2"
><a
href=
"/docs/4.0"
>
- 4.0.x
</a></li>
<li
class=
"toctree-l2"
>
<a
href=
"/docs/trunk"
>
trunk(5.0)
</a>
|
<a
href=
"/docs/4.1"
>
4.1
</a>
|
<a
href=
"/docs/4.0"
>
4.0
</a>
</li>
<li
class=
"toctree-l1"
><a
href=
"https://www.varnish-software.com/book/"
>
Varnish Book (PDF)
</a></li>
<li
class=
"toctree-l2"
><a
href=
"http://book.varnish-software.com/4.0/"
>
- 4.x
</a></li>
<li
class=
"toctree-l2"
><a
href=
"http://book.varnish-software.com/3.0/"
>
- 3.x
</a></li>
<li
class=
"toctree-l2"
>
<a
href=
"http://book.varnish-software.com/4.0/"
>
4.0
</a>
|
<a
href=
"http://book.varnish-software.com/3.0/"
>
3.0
</a>
</li>
<li
class=
"toctree-l1"
>
<a
href=
"https://github.com/varnishcache/varnish-cache"
>
Source/Bugs/Patches
</a>
</li>
<li
class=
"toctree-l1"
>
<a
href=
"/tips/index.html"
>
Tips
&
Tricks
</a>
</li>
<li
class=
"toctree-l1"
>
<a
href=
"/business/index.html"
>
Varnish Business
</a>
</li>
...
...
R1/source/index.rst
View file @
dfed979e
...
...
@@ -35,10 +35,10 @@ Future Events
`Varnish Cache Meetup #2 <http://www.meetup.com/Paris-Varnish-Cache-Meetup/events/229789817/>`_
2016-05-11 (Sydney) `Varnish-Software Summit
<http://info.varnish-software.com/sydney-summit-2016>`_
<http://info.varnish-software.com/sydney-summit-2016>`_
_
2016-05-13 (Auckland) `Varnish-Software Summit
<http://info.varnish-software.com/nz-summit-2016>`_
<http://info.varnish-software.com/nz-summit-2016>`_
_
2016-05-26 (Madrid)
`Varnish para meros mortales / Drupal Madrid Meetup <http://www.meetup.com/Drupal-Madrid/events/230709381/>`_
...
...
@@ -74,3 +74,4 @@ they collect, it will be discontinued.
support/index
extras/index
vmods/index
tips/index
R1/source/tips/index.rst
0 → 100644
View file @
dfed979e
.. _tips:
Tips & Tricks
=============
301/302 Redirects
-----------------
Synthetic responses can be used to generate 30x redirects, and
the usual way is to stash the new location in req.http.something,
and move that to resp.location in ``vcl_synth{}``.
Here is a slightly neater way, exploiting the fact that ``return(synth())``
takes two arguments::
sub vcl_recv {
if (req.url ~ "^/installation/ubuntu") {
return (synth(301, "/releases/install_ubuntu.html"));
}
if (req.url ~ "^/installation/debian") {
return (synth(302, "/releases/install_redhat.html"));
}
}
sub vcl_synth {
if (resp.status == 301 || resp.status == 302) {
set resp.http.location = resp.reason;
set resp.reason = "Moved";
return (deliver);
}
}
.. toctree::
:hidden:
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