Appearance
Varnish
Varnish is a reverse caching proxy, used as an HTTP accelerator for content-heavy dynamic websites as well as APIs. It sits in front of your application and serves cached responses, reducing the load on your application and speeding up response times.
Enabling Varnish
Hubble Studio enables the Varnish service for specific templates. When you create a new project from one of these templates, Hubble Studio automatically sets up Varnish with a VCL configuration that fits the template.
For all other projects, request it under Services > Varnish. Our team can enable and configure Varnish for you at any time, even after you've created your project. To disable Varnish again, request a change under Services > Varnish.
The Varnish configuration applies to your whole project, so every environment of the project uses the same VCL.
Viewing your configuration
You can view your Varnish configuration under Services > Varnish. There you'll find:
- Whether the Varnish service is enabled for your project
- The VCL, the Varnish Configuration Language file that controls how Varnish handles and caches incoming requests
Generated sections
Your VCL contains two placeholders. Hubble Studio replaces them with generated configuration whenever changes to your Varnish configuration are deployed, so you don't need to configure them yourself:
{{ generate_default_backend }}is replaced with the default backend, which points Varnish to your application{{ generate_purgers_acl }}is replaced with thepurgersACL, which lists the clients that are allowed to invalidate cached content
You can use the purgers ACL in your VCL to restrict who can send PURGE or BAN requests:
txt
vcl 4.1;
{{ generate_default_backend }}
{{ generate_purgers_acl }}
sub vcl_recv {
if (req.method == "PURGE") {
if (client.ip !~ purgers) {
return (synth(403, "Forbidden"));
}
return (purge);
}
}WARNING
Keep both placeholders in your VCL. Without them, Varnish can't reach your application and your application can't invalidate cached content.
Changing the VCL
WARNING
At the moment you can't change the VCL yourself!
If you need changes to your VCL, request a change under Services > Varnish and describe the changes you need.