This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vcl 6.0; | |
| # Logic for passing response objects thru a distributed VCL architecture | |
| import std; | |
| sub vcl_backend_response | |
| { | |
| if (beresp.http.X-DVCL-ttl) { | |
| set beresp.ttl = std.duration(beresp.http.X-DVCL-ttl, 0s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Updating the Cache-Control to reflect the smallest TTL included (Edgestash)" | |
| server s1 { | |
| rxreq | |
| txresp -hdr "Cache-Control: max-age=3600" -body { | |
| This is a response with 2 partials | |
| {{ > /include/p1 }} | |
| {{ > /include/p2 }} | |
| } | |
| expect req.url == "/page" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $Module json 3 JSON parsing | |
| DESCRIPTION | |
| =========== | |
| JSON parsing | |
| $Function VOID parse(PRIV_TASK, STRING json) | |
| Parse the JSON string. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Updating the Last-Modified to capture Edgestash partials" | |
| server s1 { | |
| # Content | |
| rxreq | |
| txresp -hdr "Last-Modified: Wed, 09 Aug 2017 12:00:00 GMT" -body { | |
| This is a response with 2 partials | |
| {{ > /include/p1 }} | |
| {{ > /include/p2 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Setting grace from the backend" | |
| server s1 { | |
| rxreq | |
| txresp -hdr "Cache-Control: max-age=60, stale-while-revalidate=15" | |
| } -start | |
| varnish v1 -vcl+backend { | |
| sub vcl_backend_response { | |
| set beresp.http.X-ttl = beresp.ttl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Test log" | |
| server s1 -repeat 2 { | |
| rxreq | |
| txresp | |
| } -start | |
| varnish v1 -vcl+backend { | |
| import ${vmod_std}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Conditional grace turns into HFP while obj.ttl > 0s" | |
| server s1 -repeat 4 { | |
| rxreq | |
| txresp | |
| } -start | |
| varnish v1 -vcl+backend { | |
| sub vcl_hit { | |
| set req.http.X-status = "HIT"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Test HTTP vmod Varnish callback" | |
| server s1 { | |
| rxreq | |
| txresp -status 200 | |
| expect req.url == "/123" | |
| expect req.http.Test1 == "2" | |
| rxreq | |
| txresp -status 200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Edge Logic: Securing Varnish with per user JSON data | |
| // https://info.varnish-software.com/blog/securing-varnish-plus-with-user-json-data | |
| vcl 4.0; | |
| backend default | |
| { | |
| .host = "content.company.com"; | |
| .port = "80"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| varnishtest "Do not cache stale Last Modified" | |
| server s1 { | |
| rxreq | |
| txresp -hdr "Last-Modified: Wed, 27 Apr 2016 14:05:52 GMT" -hdr "Version: 1" | |
| rxreq | |
| txresp -hdr "Last-Modified: Wed, 27 Apr 2016 16:05:52 GMT" -hdr "Version: 2" | |
| rxreq |