Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Allow HTTPS request URIs #8

Closed
retog opened this issue Aug 25, 2015 · 5 comments
Closed

Allow HTTPS request URIs #8

retog opened this issue Aug 25, 2015 · 5 comments

Comments

@retog
Copy link
Contributor

retog commented Aug 25, 2015

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.

@bergos
Copy link
Contributor

bergos commented Aug 25, 2015

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'
}

@ktk
Copy link
Contributor

ktk commented Aug 25, 2015

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.

@bergos
Copy link
Contributor

bergos commented Aug 25, 2015

OK, even easier. Configure Varnish to send the 'x-forwarded-proto' header, express-utils will do the rest.

@ktk
Copy link
Contributor

ktk commented Aug 26, 2015

I think we have a problem further up the chain, filed an issue in hitch with some details.

@ktk
Copy link
Contributor

ktk commented Aug 27, 2015

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";
  }
...

@retog retog closed this as completed Oct 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants