diff options
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable.js | 7 | ||||
-rw-r--r-- | actioncable/app/javascript/action_cable/index.js | 2 | ||||
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/commands/server/server_command.rb | 6 |
4 files changed, 10 insertions, 9 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.js b/actioncable/app/assets/javascripts/action_cable.js index 280adbfa83..4efab2ed46 100644 --- a/actioncable/app/assets/javascripts/action_cable.js +++ b/actioncable/app/assets/javascripts/action_cable.js @@ -465,14 +465,15 @@ } } function createWebSocketURL(url) { - if (url && !/^wss?:/i.test(url)) { + var webSocketURL = typeof url === "function" ? url() : url; + if (webSocketURL && !/^wss?:/i.test(webSocketURL)) { var a = document.createElement("a"); - a.href = url; + a.href = webSocketURL; a.href = a.href; a.protocol = a.protocol.replace("http", "ws"); return a.href; } else { - return url; + return webSocketURL; } } exports.Connection = Connection; diff --git a/actioncable/app/javascript/action_cable/index.js b/actioncable/app/javascript/action_cable/index.js index e9892ee821..e679745fd7 100644 --- a/actioncable/app/javascript/action_cable/index.js +++ b/actioncable/app/javascript/action_cable/index.js @@ -30,7 +30,7 @@ export function getConfig(name) { } export function createWebSocketURL(url) { - const webSocketURL = typeof url === 'function' ? url() : url; + const webSocketURL = typeof url === "function" ? url() : url if (webSocketURL && !/^wss?:/i.test(webSocketURL)) { const a = document.createElement("a") diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 9e8b38733a..88f9ac06f6 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -268,9 +268,9 @@ *Jose Luis Duran* -* Deprecate support for using the `HOST` environment to specify the server IP. +* Deprecate support for using the `HOST` environment variable to specify the server IP. - The `BINDING` environment should be used instead. + The `BINDING` environment variable should be used instead. Fixes #29516. diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb index 6082e1d6f8..43f7b76fd6 100644 --- a/railties/lib/rails/commands/server/server_command.rb +++ b/railties/lib/rails/commands/server/server_command.rb @@ -221,8 +221,8 @@ module Rails if ENV["HOST"] && !ENV["BINDING"] ActiveSupport::Deprecation.warn(<<-MSG.squish) - Using the `HOST` environment to specify the IP is deprecated and will be removed in Rails 6.1. - Please use `BINDING` environment instead. + Using the `HOST` environment variable to specify the IP is deprecated and will be removed in Rails 6.1. + Please use `BINDING` environment variable instead. MSG return ENV["HOST"] @@ -255,7 +255,7 @@ module Rails end def self.banner(*) - "rails server [thin/puma/webrick] [options]" + "rails server -u [thin/puma/webrick] [options]" end def prepare_restart |