Varnish 3: "Expected return action name" when using "synth"
Asked Answered
R

1

6

Using Varnish 3.0.7. In order to forward any non-SSL connections I've added the following subroutine to my VCL:

sub vcl_synth {
    if (resp.status == 750) {
         set resp.status = 301;
         set resp.http.Location = req.http.x-redir;
         return(deliver);
    }
}

And then in vcl_recv I've added:

if ((req.http.host ~ "^(?i)mydomain(?i)") && req.http.X-Forwarded-Proto !~ "(?i)https") {
    set req.http.x-redir = "https://" + req.http.host + req.url;
    return(synth(750, ""));
}

But I'm getting the following error:

Message from VCC-compiler:
Expected return action name.
('input' Line 225 Pos 16)
        return(synth(750, "")); 
---------------#####------------

Does anyone know why this is happening? I'm clueless after several hours of debugging...

Many thanks!

Rox answered 30/12, 2015 at 12:15 Comment(0)
P
7

vcl_synth and return(synth(750, "")) do not exists in Varnish Cache 3.x. That's valid syntax only in 4.x. In 3.x vcl_synth should be replaced by vcl_error and return(synth(750, "")) by error 750.

Pyatt answered 30/12, 2015 at 17:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.