Do not overwrite hostname in development (#6623)

do not overwrite hostname in development (#6623)

From e25b3965a7c69bc8d2db0f52f42ff122303b2cf0 Mon Sep 17 00:00:00 2001
From: Kyle Zhao <kzhao.sw@gmail.com>
Date: Mon, 19 Nov 2018 22:34:02 -0500
Subject: [PATCH] do not overwrite hostname in development (#6623)


diff --git a/config/application.rb b/config/application.rb
index 5a68990..f452dab 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -198,8 +198,10 @@ module Discourse
     # supports etags (post 1.7)
     config.middleware.delete Rack::ETag
 
-    require 'middleware/enforce_hostname'
-    config.middleware.insert_after Rack::MethodOverride, Middleware::EnforceHostname
+    unless Rails.env.development?
+      require 'middleware/enforce_hostname'
+      config.middleware.insert_after Rack::MethodOverride, Middleware::EnforceHostname
+    end
 
     require 'content_security_policy'
     config.middleware.swap ActionDispatch::ContentSecurityPolicy::Middleware, ContentSecurityPolicy::Middleware

GitHub

1 Like