commit f5659e5d
Try to handle reverse proxy issue
Changed files
| M | src/application.cpp before |
diff --git a/src/application.cpp b/src/application.cpp
index df62fb3..786520e 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -348,10 +348,13 @@ void GitApp::repo_home(std::string name) {
util::github_clone_urls(repo->remote_url(), github_hosts_);
c.clone_ssh = clone.ssh;
c.clone_https = clone.https;
- if (const std::string host = request().getenv("HTTP_HOST");
- allow_clone_ && !host.empty()) {
+ std::string host = request().getenv("HTTP_X_FORWARDED_HOST");
+ if (host.empty())
+ host = request().getenv("HTTP_HOST");
+ if (allow_clone_ && !host.empty()) {
// Behind a TLS-terminating proxy the public scheme is https even
- // though we serve plain http; honor X-Forwarded-Proto when set.
+ // though we serve plain http; honor X-Forwarded-Proto and
+ // X-Forwarded-Host when set.
std::string scheme = request().getenv("HTTP_X_FORWARDED_PROTO");
if (scheme.empty())
scheme = "http";