BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1c7bab11
Commit
1c7bab11
authored
May 03, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'blackst0ne-rails5-fix-trusted-proxies' into 'master'
[Rails5] Fix trusted proxies See merge request gitlab-org/gitlab-ce!18705
parents
0bca017d
2306e490
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
trusted_proxies.rb
config/initializers/trusted_proxies.rb
+13
-0
No files found.
config/initializers/trusted_proxies.rb
View file @
1c7bab11
...
...
@@ -22,3 +22,16 @@ end.compact
Rails
.
application
.
config
.
action_dispatch
.
trusted_proxies
=
(
[
'127.0.0.1'
,
'::1'
]
+
gitlab_trusted_proxies
)
# A monkey patch to make trusted proxies work with Rails 5.0.
# Inspired by https://github.com/rails/rails/issues/5223#issuecomment-263778719
# Remove this monkey patch when upstream is fixed.
if
Gitlab
.
rails5?
module
TrustedProxyMonkeyPatch
def
ip
@ip
||=
(
get_header
(
"action_dispatch.remote_ip"
)
||
super
).
to_s
end
end
ActionDispatch
::
Request
.
send
(
:include
,
TrustedProxyMonkeyPatch
)
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment