1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Drop support for the SERVER_ADDR header

Following up https://github.com/rails/rails/pull/42349 and
https://github.com/rack/rack/pull/1573 the `SERVER_ADDR` header can be
dropped, considering that it's not required by the CGI spec.
This commit is contained in:
Ricardo Díaz 2021-06-02 00:18:01 -05:00
parent b9f48d5d58
commit 093a4cde26
3 changed files with 7 additions and 4 deletions

View file

@ -1,3 +1,9 @@
* Drop support for the `SERVER_ADDR` header
Following up https://github.com/rack/rack/pull/1573 and https://github.com/rails/rails/pull/42349
*Ricardo Díaz*
* Set session options when initializing a basic session.
*Gannon McGibbon*

View file

@ -42,11 +42,8 @@ module ActionDispatch
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_CLIENT_IP
HTTP_X_FORWARDED_FOR HTTP_ORIGIN HTTP_VERSION
HTTP_X_CSRF_TOKEN HTTP_X_REQUEST_ID HTTP_X_FORWARDED_HOST
SERVER_ADDR
].freeze
# TODO: Remove SERVER_ADDR when we remove support to Rack 2.1.
# See https://github.com/rack/rack/commit/c173b188d81ee437b588c1e046a1c9f031dea550
ENV_METHODS.each do |env|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
# frozen_string_literal: true

View file

@ -222,7 +222,7 @@ module ActionDispatch
if forwarded = x_forwarded_host.presence
forwarded.split(/,\s?/).last
else
get_header("HTTP_HOST") || "#{server_name || server_addr}:#{get_header('SERVER_PORT')}"
get_header("HTTP_HOST") || "#{server_name}:#{get_header('SERVER_PORT')}"
end
end