mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 06:42:32 -05:00
fix azure proxy
This commit is contained in:
1 parent
11a5b5842d
commit
b7045fb3d9
1 file changed
+10
-3
@@ -6,9 +6,16 @@ class NormalizeClientIpMiddleware
|
|||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
if env['HTTP_CLIENT_IP'].present? && env['HTTP_X_CLIENT_IP'].present? &&
|
if env['HTTP_CLIENT_IP'].present?
|
||||||
env['HTTP_CLIENT_IP'].starts_with?("#{env['HTTP_X_CLIENT_IP']}:")
|
if env['HTTP_X_CLIENT_IP'].present? &&
|
||||||
env['HTTP_CLIENT_IP'] = env['HTTP_X_CLIENT_IP']
|
env['HTTP_CLIENT_IP'].starts_with?("#{env['HTTP_X_CLIENT_IP']}:")
|
||||||
|
env['HTTP_CLIENT_IP'] = env['HTTP_X_CLIENT_IP']
|
||||||
|
end
|
||||||
|
|
||||||
|
if env['HTTP_X_FORWARDED_FOR'].present? &&
|
||||||
|
env['HTTP_X_FORWARDED_FOR'].sub(/:\d+\z/, '') == env['HTTP_CLIENT_IP']
|
||||||
|
env['HTTP_X_FORWARDED_FOR'] = env['HTTP_CLIENT_IP']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
|
|||||||
Reference in new issue
Block a user