Discussion:
Dont understand how to implement this FAQ topic
Daniel Santos
2018-04-13 21:52:41 UTC
Permalink
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?
Guillaume Quintard
2018-04-13 21:57:14 UTC
Permalink
What is your goal, what don't you understand?
--
Guillaume Quintard
Post by Daniel Santos
I don't understand the this FAQ topic
<https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
.
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
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Guillaume Quintard
2018-04-14 06:17:12 UTC
Permalink
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
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>
.
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 <
Post by Guillaume Quintard
What is your goal, what don't you understand?
--
Guillaume Quintard
Post by Daniel Santos
I don't understand the this FAQ topic
<https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
.
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
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Daniel Santos
2018-04-14 17:53:52 UTC
Permalink
Thanks a lot for sharing.

A sábado, 14/04/2018, 07:17, Guillaume Quintard <
Post by Guillaume Quintard
Please keep the mail-in in the loop so others can benefit from this
discussion.
https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection
It covers exactly your use-case, I think.
--
Guillaume Quintard
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>
.
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 <
Post by Guillaume Quintard
What is your goal, what don't you understand?
--
Guillaume Quintard
Post by Daniel Santos
I don't understand the this FAQ topic
<https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
.
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
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Guillaume Quintard
2018-04-14 17:55:05 UTC
Permalink
No problem, did you manage to solve your issue?
--
Guillaume Quintard
Post by Daniel Santos
Thanks a lot for sharing.
A sábado, 14/04/2018, 07:17, Guillaume Quintard <
Post by Guillaume Quintard
Please keep the mail-in in the loop so others can benefit from this
discussion.
https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection
It covers exactly your use-case, I think.
--
Guillaume Quintard
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>
.
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 <
Post by Guillaume Quintard
What is your goal, what don't you understand?
--
Guillaume Quintard
Post by Daniel Santos
I don't understand the this FAQ topic
<https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
.
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
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Daniel Santos
2018-04-14 18:03:58 UTC
Permalink
Yes, I did.

A sábado, 14/04/2018, 18:55, Guillaume Quintard <
Post by Guillaume Quintard
No problem, did you manage to solve your issue?
--
Guillaume Quintard
Post by Daniel Santos
Thanks a lot for sharing.
A sábado, 14/04/2018, 07:17, Guillaume Quintard <
Post by Guillaume Quintard
Please keep the mail-in in the loop so others can benefit from this
discussion.
https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection
It covers exactly your use-case, I think.
--
Guillaume Quintard
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>
.
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 <
Post by Guillaume Quintard
What is your goal, what don't you understand?
--
Guillaume Quintard
Post by Daniel Santos
I don't understand the this FAQ topic
<https://github.com/varnish/hitch/wiki/FAQ#redirect-varnish-http-clients-to-https>
.
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
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Loading...