Dont understand how to implement this FAQ topic

Daniel Santos dannysantos1985 at gmail.com
Sat Apr 14 18:03:58 UTC 2018


Yes, I did.

A sábado, 14/04/2018, 18:55, Guillaume Quintard <
guillaume at varnish-software.com> escreveu:

> No problem, did you manage to solve your issue?
>
> --
> Guillaume Quintard
>
> On Sat, Apr 14, 2018, 19:54 Daniel Santos <dannysantos1985 at gmail.com>
> wrote:
>
>> Thanks a lot for sharing.
>>
>> A sábado, 14/04/2018, 07:17, Guillaume Quintard <
>> guillaume at varnish-software.com> escreveu:
>>
>>> Please keep the mail-in in the loop so others can benefit from this
>>> discussion.
>>>
>>> Have a look at this:
>>> https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection
>>>
>>> It covers exactly your use-case, I think.
>>>
>>> --
>>> Guillaume Quintard
>>>
>>>
>>> On Sat, Apr 14, 2018, 00:01 Daniel Santos <dannysantos1985 at gmail.com>
>>> wrote:
>>>
>>>> I don't understand where I will put the set req.backend_hint on
>>>> 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
>>>> <https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
>>>> .
>>>> And if in order to have http redirect to https will I have to put:
>>>>
>>>> if (std.port(local.ip) == 80 && req.http.host ~ "^(?i)example.com$") {
>>>>         set req.http.x-redir = "https://" + req.http.host + req.url;
>>>>         return(synth(301));
>>>>     }
>>>>
>>>>
>>>> for every domain or is there a way to make a force http to https rule
>>>> for all the domains?
>>>>
>>>> 2018-04-13 22:57 GMT+01:00 Guillaume Quintard <
>>>> guillaume at varnish-software.com>:
>>>>
>>>>> What is your goal, what don't you understand?
>>>>>
>>>>> --
>>>>> Guillaume Quintard
>>>>>
>>>>> On Fri, Apr 13, 2018, 23:52 Daniel Santos <dannysantos1985 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> 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?
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> varnish-misc mailing list
>>>>>> varnish-misc at varnish-cache.org
>>>>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>>>>
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20180414/1241ff5e/attachment.html>


More information about the varnish-misc mailing list