EventStore/EventStore — pull request #244 by adbrowne (2014-09-20 15:39:27+00:00)
Title: Support for X-Forwarded headers

Support has been added for X-Forwarded-Port and X-Forwarded-Proto.
This will enable reverse proxy servers to feed the public port
and protocol to eventstore. These values will be used in generating
URLs in responses.

I have tested out the port header with varnish using the following settings:

sub vcl_recv {
set req.http.X-Forwarded-Port = "6081";
}

and it worked well. It works fine for streams and links. The new angular UI in 3.0 seems hardcoded to localhost:2113 so hopefully when that limitation is fixed it will work with a reverse proxy as well.

Varnish won't terminate SSL but I have tested the X-Forwarded-Proto with curl and it behaves as expected:
curl http://localhost:2113/streams/%24all -u admin:changeit -H 'Host: example.com' -H 'X-Forwarded-Port: 2114' -H 'X-Forwarded-Proto: https'