Skip to content

IBX-10312: Rebranded VCL #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/varnish/vcl/parameters.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// Replace the host to fit your setup
//
// For additional example see:
// https://github.com/ezsystems/ezplatform/blob/master/doc/docker/entrypoint/varnish/parameters.vcl
// https://github.com/ibexa/docker/blob/main/docker/entrypoint/varnish/parameters.vcl

backend ezplatform {
backend ibexa {
.host = "127.0.0.1"; // Replace with hostname/ip of the application server
.port = "80";
}

// ACL for invalidators IP
//
// Alternative using HTTPCACHE_VARNISH_INVALIDATE_TOKEN : VCL code also allows for token based invalidation, to use it define a
// shared secret using env variable HTTPCACHE_VARNISH_INVALIDATE_TOKEN and eZ Platform will also use that for configuring this
// bundle. This is prefered for setups such as platform.sh/eZ Platform Cloud, where circular service dependency is
// shared secret using env variable HTTPCACHE_VARNISH_INVALIDATE_TOKEN and Ibexa DXP will also use that for configuring this
// bundle. This is prefered for setups such as Ibexa Cloud, where circular service dependency is
// unwanted. If you use this, use a strong cryptological secure hash & make sure to keep the token secret.
// Use ez_purge_acl for invalidation by token.
// Use ibexa_purge_acl for invalidation by token.
acl invalidators {
"127.0.0.1";
"192.168.0.0"/16;
Expand Down
20 changes: 10 additions & 10 deletions docs/varnish/vcl/varnish5.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include "parameters.vcl";
sub vcl_recv {

// Set the backend
set req.backend_hint = ezplatform;
set req.backend_hint = ibexa;

// Add a Surrogate-Capability header to announce ESI support.
set req.http.Surrogate-Capability = "abc=ESI/1.0";
Expand All @@ -31,7 +31,7 @@ sub vcl_recv {
}

// Trigger cache purge if needed
call ez_purge;
call ibexa_purge;

// Don't cache requests other than GET and HEAD.
if (req.method != "GET" && req.method != "HEAD") {
Expand Down Expand Up @@ -72,7 +72,7 @@ sub vcl_recv {
set req.url = std.querysort(req.url);

// Retrieve client user context hash and add it to the forwarded request.
call ez_user_context_hash;
call ibexa_user_context_hash;

// If it passes all these tests, do a lookup anyway.
return (hash);
Expand Down Expand Up @@ -142,13 +142,13 @@ sub vcl_backend_response {
// Handle purge
// You may add FOSHttpCacheBundle tagging rules
// See http://foshttpcache.readthedocs.org/en/latest/varnish-configuration.html#id4
sub ez_purge {
sub ibexa_purge {
// Retrieve purge token, needs to be here due to restart, match for PURGE method done within
call ez_invalidate_token;
call ibexa_invalidate_token;

# Adapted with acl from vendor/friendsofsymfony/http-cache/resources/config/varnish/fos_tags_xkey.vcl
if (req.method == "PURGEKEYS") {
call ez_purge_acl;
call ibexa_purge_acl;

# If neither of the headers are provided we return 400 to simplify detecting wrong configuration
if (!req.http.xkey-purge && !req.http.xkey-softpurge) {
Expand All @@ -171,13 +171,13 @@ sub ez_purge {

# Adapted with acl from vendor/friendsofsymfony/http-cache/resources/config/varnish/fos_purge.vcl
if (req.method == "PURGE") {
call ez_purge_acl;
call ibexa_purge_acl;

return (purge);
}
}

sub ez_purge_acl {
sub ibexa_purge_acl {
if (req.http.x-invalidate-token) {
if (req.http.x-invalidate-token != req.http.x-backend-invalidate-token) {
return (synth(405, "Method not allowed"));
Expand All @@ -188,7 +188,7 @@ sub ez_purge_acl {
}

// Sub-routine to get client user context hash, used to for being able to vary page cache on user rights.
sub ez_user_context_hash {
sub ibexa_user_context_hash {

// Prevent tampering attacks on the hash mechanism
if (req.restarts == 0
Expand Down Expand Up @@ -237,7 +237,7 @@ sub ez_user_context_hash {
}

// Sub-routine to get invalidate token.
sub ez_invalidate_token {
sub ibexa_invalidate_token {
// Prevent tampering attacks on the token mechanisms
if (req.restarts == 0
&& (req.http.accept ~ "application/vnd.ezplatform.invalidate-token"
Expand Down
20 changes: 10 additions & 10 deletions docs/varnish/vcl/varnish6.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include "parameters.vcl";
sub vcl_recv {

// Set the backend
set req.backend_hint = ezplatform;
set req.backend_hint = ibexa;

// Add a Surrogate-Capability header to announce ESI support.
set req.http.Surrogate-Capability = "abc=ESI/1.0";
Expand All @@ -31,7 +31,7 @@ sub vcl_recv {
}

// Trigger cache purge if needed
call ez_purge;
call ibexa_purge;

// Don't cache requests other than GET and HEAD.
if (req.method != "GET" && req.method != "HEAD") {
Expand Down Expand Up @@ -72,7 +72,7 @@ sub vcl_recv {
set req.url = std.querysort(req.url);

// Retrieve client user context hash and add it to the forwarded request.
call ez_user_context_hash;
call ibexa_user_context_hash;

// If it passes all these tests, do a lookup anyway.
return (hash);
Expand Down Expand Up @@ -142,13 +142,13 @@ sub vcl_backend_response {
// Handle purge
// You may add FOSHttpCacheBundle tagging rules
// See http://foshttpcache.readthedocs.org/en/latest/varnish-configuration.html#id4
sub ez_purge {
sub ibexa_purge {
// Retrieve purge token, needs to be here due to restart, match for PURGE method done within
call ez_invalidate_token;
call ibexa_invalidate_token;

# Adapted with acl from vendor/friendsofsymfony/http-cache/resources/config/varnish/fos_tags_xkey.vcl
if (req.method == "PURGEKEYS") {
call ez_purge_acl;
call ibexa_purge_acl;

# If neither of the headers are provided we return 400 to simplify detecting wrong configuration
if (!req.http.xkey-purge && !req.http.xkey-softpurge) {
Expand All @@ -171,13 +171,13 @@ sub ez_purge {

# Adapted with acl from vendor/friendsofsymfony/http-cache/resources/config/varnish/fos_purge.vcl
if (req.method == "PURGE") {
call ez_purge_acl;
call ibexa_purge_acl;

return (purge);
}
}

sub ez_purge_acl {
sub ibexa_purge_acl {
if (req.http.x-invalidate-token) {
if (req.http.x-invalidate-token != req.http.x-backend-invalidate-token) {
return (synth(405, "Method not allowed"));
Expand All @@ -188,7 +188,7 @@ sub ez_purge_acl {
}

// Sub-routine to get client user context hash, used to for being able to vary page cache on user rights.
sub ez_user_context_hash {
sub ibexa_user_context_hash {

// Prevent tampering attacks on the hash mechanism
if (req.restarts == 0
Expand Down Expand Up @@ -237,7 +237,7 @@ sub ez_user_context_hash {
}

// Sub-routine to get invalidate token.
sub ez_invalidate_token {
sub ibexa_invalidate_token {
// Prevent tampering attacks on the token mechanisms
if (req.restarts == 0
&& (req.http.accept ~ "application/vnd.ezplatform.invalidate-token"
Expand Down
20 changes: 10 additions & 10 deletions docs/varnish/vcl/varnish7.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include "/etc/varnish/parameters.vcl";
sub vcl_recv {

// Set the backend
set req.backend_hint = ezplatform;
set req.backend_hint = ibexa;

// Add a Surrogate-Capability header to announce ESI support.
set req.http.Surrogate-Capability = "abc=ESI/1.0";
Expand All @@ -29,7 +29,7 @@ sub vcl_recv {
}

// Trigger cache purge if needed
call ez_purge;
call ibexa_purge;

// Don't cache requests other than GET and HEAD.
if (req.method != "GET" && req.method != "HEAD") {
Expand Down Expand Up @@ -70,7 +70,7 @@ sub vcl_recv {
set req.url = std.querysort(req.url);

// Retrieve client user context hash and add it to the forwarded request.
call ez_user_context_hash;
call ibexa_user_context_hash;

// If it passes all these tests, do a lookup anyway.
return (hash);
Expand Down Expand Up @@ -117,13 +117,13 @@ sub vcl_backend_response {
// Handle purge
// You may add FOSHttpCacheBundle tagging rules
// See http://foshttpcache.readthedocs.org/en/latest/varnish-configuration.html#id4
sub ez_purge {
sub ibexa_purge {
// Retrieve purge token, needs to be here due to restart, match for PURGE method done within
call ez_invalidate_token;
call ibexa_invalidate_token;

# Adapted with acl from vendor/friendsofsymfony/http-cache/resources/config/varnish/fos_tags_xkey.vcl
if (req.method == "PURGEKEYS") {
call ez_purge_acl;
call ibexa_purge_acl;

# If neither of the headers are provided we return 400 to simplify detecting wrong configuration
if (!req.http.xkey-purge && !req.http.xkey-softpurge) {
Expand All @@ -146,13 +146,13 @@ sub ez_purge {

# Adapted with acl from vendor/friendsofsymfony/http-cache/resources/config/varnish/fos_purge.vcl
if (req.method == "PURGE") {
call ez_purge_acl;
call ibexa_purge_acl;

return (purge);
}
}

sub ez_purge_acl {
sub ibexa_purge_acl {
if (req.http.x-invalidate-token) {
if (req.http.x-invalidate-token != req.http.x-backend-invalidate-token) {
return (synth(405, "Method not allowed"));
Expand All @@ -163,7 +163,7 @@ sub ez_purge_acl {
}

// Sub-routine to get client user context hash, used to for being able to vary page cache on user rights.
sub ez_user_context_hash {
sub ibexa_user_context_hash {

// Prevent tampering attacks on the hash mechanism
if (req.restarts == 0
Expand Down Expand Up @@ -212,7 +212,7 @@ sub ez_user_context_hash {
}

// Sub-routine to get invalidate token.
sub ez_invalidate_token {
sub ibexa_invalidate_token {
// Prevent tampering attacks on the token mechanisms
if (req.restarts == 0
&& (req.http.accept ~ "application/vnd.ezplatform.invalidate-token"
Expand Down
Loading