<div dir="auto">Please keep the mail-in in the loop so others can benefit from this discussion.<div dir="auto"><br></div><div dir="auto">Have a look at this: <a href="https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection">https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection</a></div><div dir="auto"><br></div><div dir="auto">It covers exactly your use-case, I think.</div><div dir="auto"><br><div data-smartmail="gmail_signature" dir="auto">-- <br>Guillaume Quintard </div></div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Sat, Apr 14, 2018, 00:01 Daniel Santos <<a href="mailto:dannysantos1985@gmail.com">dannysantos1985@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I don't understand where I will put the set req.backend_hint on <a href="https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https" target="_blank" rel="noreferrer">https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-cliehttps://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-httpsnts-to-https</a> .<br></div>And if in order to have http redirect to https will I have to put:<br><pre><code>if (std.port(local.ip) == 80 && req.http.host ~ "^(?i)<a href="http://example.com" target="_blank" rel="noreferrer">example.com</a>$") {
        set req.http.x-redir = "https://" + req.http.host + req.url;
        return(synth(301));
    }</code></pre><br></div>for every domain or is there a way to make a force http to https rule for all the domains?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-04-13 22:57 GMT+01:00 Guillaume Quintard <span dir="ltr"><<a href="mailto:guillaume@varnish-software.com" target="_blank" rel="noreferrer">guillaume@varnish-software.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">What is your goal, what don't you understand? <br><br><div data-smartmail="gmail_signature">-- <br>Guillaume Quintard </div></div><br><div class="gmail_quote"><div><div class="m_-6248082081177305765h5"><div dir="ltr">On Fri, Apr 13, 2018, 23:52 Daniel Santos <<a href="mailto:dannysantos1985@gmail.com" target="_blank" rel="noreferrer">dannysantos1985@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-6248082081177305765h5"><div dir="ltr">I don't understand the <a href="https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https" rel="noreferrer noreferrer" target="_blank">this FAQ topic</a>.<br><div class="gmail_quote"><div dir="ltr"><p>
I want to implement it. In my <code>/etc/varnish/default.vcl</code> I have this:</p>
<pre><code>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 ~ "<a href="http://domain1.com" rel="noreferrer noreferrer" target="_blank">domain1.com</a>") {
        set req.backend_hint = apache;
    }
    elsif(req.http.host == "<a href="http://domain2.com" rel="noreferrer noreferrer" target="_blank">domain2.com</a>") {
        set req.backend_hint = node_hello;
    }
}
</code></pre>
<p>How should my implementation become?</p><br></div>
</div><br></div></div></div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" rel="noreferrer noreferrer" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer noreferrer noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a></blockquote></div>
</blockquote></div><br></div>
</blockquote></div></div>