Fwd: Dont understand how to implement this FAQ topic

Daniel Santos dannysantos1985 at gmail.com
Fri Apr 13 21:52:41 UTC 2018


I don't understand the this FAQ topic
<https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
.

I want to implement it. In my /etc/varnish/default.vcl I have this:

backend apache {
    .host = "127.0.0.1";
    .port = "5555";
}

backend node_hello {
    .host = "127.0.0.1";
    .port = "5556";
}

import std;

sub vcl_recv {
    # Happens before we check if we have this in cache already.
    #
    # Typically you clean up the request here, removing cookies you don't need,
    # rewriting the request, etc.

    if ((std.port(local.ip) == 6086) && (std.port(server.ip) == 443)) {
        set req.http.X-Forwarded-Proto = "https";
    }

    if(req.http.host ~ "domain1.com") {
        set req.backend_hint = apache;
    }
    elsif(req.http.host == "domain2.com") {
        set req.backend_hint = node_hello;
    }
}

How should my implementation become?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20180413/5dcd910f/attachment.html>


More information about the varnish-misc mailing list