Skip to content

get the real client ip address.#3588

Merged
mitchelsellers merged 3 commits intodnnsoftware:developfrom
zyhfish:bug/issue-3587
Mar 6, 2020
Merged

get the real client ip address.#3588
mitchelsellers merged 3 commits intodnnsoftware:developfrom
zyhfish:bug/issue-3587

Conversation

@zyhfish
Copy link
Copy Markdown
Contributor

@zyhfish zyhfish commented Feb 20, 2020

Fix #3587

Copy link
Copy Markdown
Contributor

@mitchelsellers mitchelsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I'd like to update the documentation included a bit on this since it is adding a new API to the process

Comment thread DNN Platform/Library/Common/Utilities/NetworkUtils.cs Outdated
Comment thread DNN Platform/Library/Common/Utilities/NetworkUtils.cs Outdated
Comment thread DNN Platform/Library/Common/Utilities/NetworkUtils.cs Outdated
Copy link
Copy Markdown
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@valadas valadas added this to the 9.5.1 milestone Mar 3, 2020
@CMarius94
Copy link
Copy Markdown
Contributor

According to MDN the specified header can return a list of IPs due to proxies. In our development environment we had this bug because we already have an internal method for getting the UserIP (MyTokens geolocation token, for example).

Some load balancers/proxies do add their IP to this header, others don't, others use another header field. It all depends on their configuration, but in order to prevent unwanted behavior, i think you should split by comma and use the first IP found in the header.

Comment thread DNN Platform/Library/Common/Utilities/NetworkUtils.cs Outdated
Copy link
Copy Markdown
Contributor

@mitchelsellers mitchelsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mitchelsellers mitchelsellers merged commit 8574a4e into dnnsoftware:develop Mar 6, 2020
@valadas valadas modified the milestones: 9.5.1, 9.6.0 Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ip filter won't work under load balance environment

4 participants