Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for IP resolution from x-Forwarded-For with multiple proxies #2359

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Feb 13, 2025

Closes #2351

Fix visitor IP address resolution when Shlink is served behind more than one reverse proxy.

This regression was introduced due to a change in behavior in akrabat/rka-ip-address-middleware, that now picks the first address from the right after excluding all trusted proxies.

Since Shlink does not set trusted proxies, this means the first IP from the right is now picked instead of the first from the left, so we now reverse the list before trying to resolve the IP, to get back previous behavior.

In the future, Shlink will allow you to define trusted proxies, to avoid other potential side effects because of this reversing of the list.

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.78%. Comparing base (65c0103) to head (c650a3e).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #2359   +/-   ##
==========================================
  Coverage      93.77%   93.78%           
- Complexity      1702     1705    +3     
==========================================
  Files            276      277    +1     
  Lines           5895     5904    +9     
==========================================
+ Hits            5528     5537    +9     
  Misses           367      367           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya merged commit a1f2e6d into shlinkio:develop Feb 13, 2025
23 checks passed
@acelaya acelaya deleted the feature/multi-proxy-fix branch February 13, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote Addr are not handled the same since akrabat/ip-address-middleware >= 2.5
1 participant