Closed bertt closed 7 years ago
Code to be added:
ExternalURI = r.Header.Get("X-Forwarded-For")
With some checks
maybe easier method: create middleware function that's called last and inspects the response. And replaces the url's in the response.
see pr https://github.com/Geodan/gost/pull/93 for middleware option
fixed
when running in Docker this seems not working (X-Forwarded-For header not set in nginx?), have to check it again
header X-Forwarded-For is indeed empty, but why
cannot fix it easily now. testing on http://labs.play-with-docker.com/ , but cannot get the outside serverurl. Workaround is to set external_uri in environment vars in docker-compose file.
We currently use the gost_server_external_uri environment variable for sending absolute url's in the responses. When running GOST behind a proxy server, we can also use HTTP header X-Forwarded-Server for constructing the absolute url's. In this case, customers don't have to set the gost_server_external_uri
Proposal: 1] Use gost_server_external_uri if available, if not: 2] Use X-Forwarded-Server if available, if not: 3] use default (localhost)