Questions tagged [varnish-vcl]

The Varnish Configuration Language (VCL) is a small domain-specific language used to define request handling and caching policies for the Varnish HTTP accelerator. Do not confuse this with the Visual Component Library (VCL) used in Delphi and C++Builder. Use the "vcl" tag for questions related to those products.

The VCL language is a small domain-specific language designed to be used to define request handling and document caching policies for the Varnish HTTP accelerator. When a new configuration is loaded, the varnishd management process translates the VCL code to C and compiles it to a shared object which is then dynamically linked into the server process.

The VCL documentation can be found on the documentation site.

677 questions
4
votes
1 answer

Varnish C VRT variables/functions

I'm starting to pick up varnish and have come across references to VRT functions in C code in our configuration (and examples on the net) that I can't find documentation on (that I understand, my C knowledge is non-existant). This is the best I can…
yoshiwaan
  • 479
  • 4
  • 11
4
votes
1 answer

Varnish VCL check if cookie does not exist

I need to check for a designexception if a cookie does not exist. I only know how to check if a cookie exists. if (req.http.Cookie ~ "cookiename") {}
exe
  • 539
  • 7
  • 18
4
votes
2 answers

Varnish - PURGE request does not purge hash_data() URL

In vcl_hash, I have backend default { .host = "127.0.0.1"; .port = "8080"; } acl purge { "localhost"; } sub vcl_hash { if(req.http.Cookie ~ "isLogin") { hash_data("1"); } } sub vcl_recv { …
Charanjeet Kaur
  • 1,199
  • 3
  • 14
  • 27
4
votes
1 answer

Upgrade to varnish v4

We've upgraded varnish v3 to v4 and I currently working on converting my vcl. In the v3 version we've used inline C to set and read headers with following functions: VRT_GetHdr(sp, HDR_REQ, header); VRT_SetHdr(sp, HDR_REQ, header, value ,…
4
votes
1 answer

Apache/varnish trailing slash with port issue

I have a setup (php application) with :: varnish (port 80) -> apache port (8080) By default apache adds trailing slashes to directories but when it does it redirect with the port. e.g. http:/www.domain.com/folder redirect to…
space_balls
  • 1,383
  • 2
  • 14
  • 29
4
votes
2 answers

Sending custom response back from varnish through VCL

Is there any way to send back custom responses from varnish itself? if (req.url ~ "^/hello") { return "hello world"; }
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
4
votes
1 answer

Can we have two varnish on two ports running on same system?

I was just wandering if we can have two varnish instances running on separate ports on the same machine? I was trying to implement active-active mode on local.
Charanjeet Kaur
  • 1,199
  • 3
  • 14
  • 27
4
votes
1 answer

How to cache dynamic content in varnish?

I am working on an RoR app. I want to set a ttl for sold out items. The sold_out_status function returns the productIds of of sold-out products and is defined as: def sold_out_status query_str = params[:pids] pids = query_str.split(",") sold_outs…
nish
  • 6,952
  • 18
  • 74
  • 128
4
votes
1 answer

Unable to restart varnish using "service varnish restart"

I made changes in "/etc/default/varnish" as well as the vcl file "/etc/varnish/default.vcl" and therefore want to restart varnish. But I'm unable to figure out what's wrong. Already spent more than an hour lookijng into it but no luck. Following are…
nish
  • 6,952
  • 18
  • 74
  • 128
4
votes
2 answers

Varnish S3-like, signed, time-limited request before delivering objects, in VCL

This question may seem a bit odd, but is it possible, with a poor-mans solution in VCL, to parse a signed request (with a shared secret key, aka poor-mans solution of HMAC), created by the referrer (main) site, and only serve the content from…
Joe
  • 921
  • 1
  • 10
  • 16
4
votes
1 answer

Change the url of the backend but not the client one using Varnish

I want to manipulate the client url "www.example.com/download.." to "one.other.com/download... But I want that the url on the client maintain the first "www.example.com/download" Is there any way with Varnish 3 to do this??
user2072574
  • 41
  • 1
  • 2
4
votes
1 answer

Varnish remove specific cookies from backend response

I need to remove specific cookies from the backend response in varnish. My backend server sets a bunch of cookies that I don't need and unfortunately I can not control, so I want to delete them. However I need some of the cookies, so I want to be…
Martin Taleski
  • 6,033
  • 10
  • 40
  • 78
4
votes
2 answers

Purge all files under a directory with Varnish HTTP accelerator

Is it possible to purge all files underneath a specific directory using Varnish? How could you go about completing this in a PHP script? For example, if a URL includes the path /product/a-specific-product/, is it also possible to purge files such as…
Ollie
  • 544
  • 4
  • 22
4
votes
1 answer

wget --mirror not creating varnish cache

I have varnish cache installed on my server in port 80 with Apache as content server on port 8080. If I run wget --mirror example.com it should crawl through my entire website and create the varnish cache, right? It does not. For eg., by running…
Harshit
  • 351
  • 2
  • 7
4
votes
2 answers

How to check if backend is healthy in vcl_recv

I have pretty sophisticated varnish config. I can't really use the directors and doing the routes manually. //webservice1 and webservice2 has probes working there set req.backend = webservice1; if (req.backend.healthy) { #redirect there…
NewRK
  • 409
  • 3
  • 15