Closed retog closed 9 years ago
The protocol field doesn't contain any information about SSL/TLS in newer version of node.js. This code should fix the problem:
if (this.socket.ssl) {
absoluteUrl.protocol += 's'
}
Just to clarify: The SSL request doesn't end up on node, I have an SSL terminator/proxy in front of Varnish and then Varnish sends it to the backend. But the dereferencing should be the SSL URI, not the non-SSL one.
OK, even easier. Configure Varnish to send the 'x-forwarded-proto' header, express-utils will do the rest.
I think we have a problem further up the chain, filed an issue in hitch with some details.
After the feedback from the hitch maintainers I've added the following to my Varnish setup:
acl SSLfromlocalhost {
"localhost";
}
sub vcl_recv {
set req.http.X-Forwarded-Port = "80";
# check if the request is comming from localhost, then it is from hitch (SSL terminator)
if(client.ip ~ SSLfromlocalhost)
{
set req.http.x-forwarded-proto = "https";
set req.http.X-Forwarded-Port = "443";
}
...
Currently trifid assumes that the schema is HTTP when reconstructing the request URI so it cannot be used if it exposed to the outside via HTTPS-URIs. As afaik there is no way to detect the schema of URI from the request headers wether to assume HTTP or HTTPS should be a setting in config.js.