diff --git a/api/webserver/route_handler.go b/api/webserver/route_handler.go
index 8c5ff41de4b223eb428e1e1bdf0a079d3a047b71..709889ce1f1c78d24c9fcb0e97cd357b942e858c 100644
--- a/api/webserver/route_handler.go
+++ b/api/webserver/route_handler.go
@@ -31,7 +31,7 @@ type handler struct {
 
 func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	isUsingForwardedHost := false
-	if r.Header.Get("X-Forwarded-Host") != "" {
+	if r.Header.Get("X-Forwarded-Host") != "" && !config.Get().General.IgnoreForwardedHost  {
 		r.Host = r.Header.Get("X-Forwarded-Host")
 		isUsingForwardedHost = true
 	}
diff --git a/common/config/config.go b/common/config/config.go
index 8a4320eb8e39f59bdd604b8eeb0c998076573bfc..2e44d12fe58892bb32a27e1c6aaed55877d3f5be 100644
--- a/common/config/config.go
+++ b/common/config/config.go
@@ -23,10 +23,11 @@ type HomeserverConfig struct {
 }
 
 type GeneralConfig struct {
-	BindAddress     string `yaml:"bindAddress"`
-	Port            int    `yaml:"port"`
-	LogDirectory    string `yaml:"logDirectory"`
-	TrustAnyForward bool   `yaml:"trustAnyForwardedAddress"`
+	BindAddress         string `yaml:"bindAddress"`
+	Port                int    `yaml:"port"`
+	LogDirectory        string `yaml:"logDirectory"`
+	TrustAnyForward     bool   `yaml:"trustAnyForwardedAddress"`
+	IgnoreForwardedHost bool   `yaml:"ignoreForwardedHost"`
 }
 
 type DbPoolConfig struct {
@@ -219,10 +220,11 @@ func Get() *MediaRepoConfig {
 func NewDefaultConfig() *MediaRepoConfig {
 	return &MediaRepoConfig{
 		General: &GeneralConfig{
-			BindAddress:     "127.0.0.1",
-			Port:            8000,
-			LogDirectory:    "logs",
-			TrustAnyForward: false,
+			BindAddress:         "127.0.0.1",
+			Port:                8000,
+			LogDirectory:        "logs",
+			TrustAnyForward:     false,
+			IgnoreForwardedHost: false,
 		},
 		Database: &DatabaseConfig{
 			Postgres: "postgres://your_username:your_password@localhost/database_name?sslmode=disable",