From b7b9960558ecc100568670508c76eec92deafa8b Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 6 May 2019 13:26:57 +0800 Subject: [PATCH] DEV: Fix missing port in URLs in development mode. --- lib/discourse.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/discourse.rb b/lib/discourse.rb index 51f0e013131..b23078cd596 100644 --- a/lib/discourse.rb +++ b/lib/discourse.rb @@ -263,6 +263,11 @@ module Discourse default_port = SiteSetting.force_https? ? 443 : 80 url = "#{base_protocol}://#{current_hostname}" url << ":#{SiteSetting.port}" if SiteSetting.port.to_i > 0 && SiteSetting.port.to_i != default_port + + if Rails.env.development? && SiteSetting.port.blank? + url << ":#{ENV["UNICORN_PORT"] || 3000}" + end + url end