Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-etag
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-etag
Commits
ef09aea2
Unverified
Commit
ef09aea2
authored
Apr 05, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo/test vmod-etag use for ESI assembled page caching
parent
61eab18d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
1 deletion
+99
-1
Makefile.am
src/Makefile.am
+2
-1
etag_esi.vtc
src/vtc/etag_esi.vtc
+97
-0
No files found.
src/Makefile.am
View file @
ef09aea2
...
...
@@ -29,7 +29,8 @@ AM_VTC_LOG_FLAGS = \
-p
vmod_path
=
"
$(abs_builddir)
/.libs:
$(vmoddir)
:
$(VARNISHAPI_VMODDIR)
"
TESTS
=
\
vtc/vmod_etag.vtc
vtc/vmod_etag.vtc
\
vtc/etag_esi.vtc
# Documentation
...
...
src/vtc/etag_esi.vtc
0 → 100644
View file @
ef09aea2
varnishtest "demo/test vmod-etag use for ESI assembled page caching"
server s1 {
rxreq
expect req.url == "/esi"
txresp -body {
<html><head>
head
</head>
<esi:include
src=
"/body"
/>
footer
</html>
}
rxreq
expect req.url == "/body"
txresp -body {Body Content}
} -start
varnish v1 -arg "-a :0 -a self=${tmpdir}/self.sock" -vcl+backend {
import etag;
# to adjust:
# - url pattern to be handled ("^/esi")
# - beresp.ttl
# - beresp.grace - important because of do_stream
backend self {
.path = "${tmpdir}/self.sock";
}
sub hash_etagesi {
if (local.socket != "self") {
return;
}
hash_data("self");
}
sub backend_fetch_etagesi {
if (local.socket == "self" || bereq.url !~ "^/esi") {
return;
}
set bereq.backend = self;
return (fetch);
}
sub backend_response_etagesi {
if (local.socket == "self" || bereq.url !~ "^/esi") {
return;
}
set beresp.do_stream = false;
set beresp.do_esi = false;
set beresp.do_gunzip = true;
set beresp.ttl = 1m;
set beresp.grace = 1m;
set beresp.filters = beresp.filters + " gzip etag";
return (deliver);
}
sub vcl_hash {
call hash_etagesi;
}
sub vcl_backend_fetch {
call backend_fetch_etagesi;
}
sub vcl_backend_response {
call backend_response_etagesi;
set beresp.do_esi = true;
}
sub vcl_deliver {
set resp.http.hits = obj.hits;
}
} -start
client c1 {
txreq -url "/esi" -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.hits == 0
expect resp.http.ETag == {"vetag697613794b241e8317dae79d014899c6103bc6fc739192fe515b5dfa32bbdd27"}
txreq -url "/esi"
rxresp
expect resp.status == 200
expect resp.http.hits == 1
expect resp.http.ETag == {W/"vetag697613794b241e8317dae79d014899c6103bc6fc739192fe515b5dfa32bbdd27"}
expect resp.body == {
<html><head>
head
</head>
Body Content
footer
</html>
}
} -run
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