From 631244671a181cc0579b2c037cf637306881f3ef Mon Sep 17 00:00:00 2001 From: rashpile Date: Thu, 1 Feb 2024 20:38:06 +0000 Subject: [PATCH] send x-forwarded headers for ssl static mode as well --- README.md | 2 +- app/proxy/proxy.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22f2d1b..03e0ea5 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ In case if rules set as a part of docker compose environment, destination with t ## SSL support -SSL mode (by default none) can be set to `auto` (ACME/LE certificates), `static` (existing certificate) or `none`. If `auto` turned on SSL certificate will be issued automatically for all discovered server names. User can override it by setting `--ssl.fqdn` value(s). In `auto` SSL mode, Reproxy will automatically add the `X-Forwarded-Proto` and `X-Forwarded-Port` headers. These headers are useful for services behind the proxy to know the original protocol (http or https) and port number used by the client. +SSL mode (by default none) can be set to `auto` (ACME/LE certificates), `static` (existing certificate) or `none`. If `auto` turned on SSL certificate will be issued automatically for all discovered server names. User can override it by setting `--ssl.fqdn` value(s). In `auto` and `static` SSL mode, Reproxy will automatically add the `X-Forwarded-Proto` and `X-Forwarded-Port` headers. These headers are useful for services behind the proxy to know the original protocol (http or https) and port number used by the client. ## Headers diff --git a/app/proxy/proxy.go b/app/proxy/proxy.go index b501b03..c8a289c 100644 --- a/app/proxy/proxy.go +++ b/app/proxy/proxy.go @@ -212,7 +212,7 @@ func (h *Http) proxyHandler() http.HandlerFunc { uu := ctx.Value(ctxURL).(*url.URL) keepHost := ctx.Value(ctxKeepHost).(bool) r.Header.Add("X-Forwarded-Host", r.Host) - if h.SSLConfig.SSLMode == SSLAuto { + if h.SSLConfig.SSLMode == SSLAuto || h.SSLConfig.SSLMode == SSLStatic { r.Header.Add("X-Forwarded-Proto", "https") r.Header.Add("X-Forwarded-Port", "443") }