mirror of
https://github.com/go-shiori/shiori.git
synced 2026-04-25 06:25:54 +03:00
[PR #603] [MERGED] fix(log): record user real ip from headers #688
Labels
No labels
component:backend
component:builds
component:builds
component:extension
component:frontend
component:readability
database
database:mysql
database:postgres
database:sqlite
feature:ebooks
github_actions
good first issue
hacktoberfest
note:duplicate?
note:fixed?
note:out-of-scope?
os:windows
priority:high
priority:low
pull-request
resolution:as-intended
resolution:cant-reproduce
resolution:duplicate
resolution:fixed
resolution:wontfix
tag:TBD
tag:big-task
tag:help-wanted
tag:huge-data
tag:meta
tag:more-info
tag:next
tag:no-stale
tag:requires-migrations
tag:research
tag:security 🛡️
tag:stale
tag:waiting-for-assignee
type:bug
type:documentation
type:enhancement
type:meta
type:ux
user:cli
user:web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shiori#688
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/go-shiori/shiori/pull/603
Author: @Tomilla
Created: 4/18/2023
Status: ✅ Merged
Merged: 6/11/2023
Merged by: @fmartingr
Base:
master← Head:get_user_real_ip_from_header📝 Commits (10+)
f21e0e2fix(real_ip): get user real ip from headers of request4ef5c34fix(real_ip): compatible with those header with multiple IP values separated by commasd3c8fe7test(real_ip): add benchmark for IPv4 and IPv6 private address check9bd5231fix(real_ip): check empty, then remove leading and tailing comma char, finally locate first IP fieldc5c0b60test(real_ip): move checker logic into utils and add more unit test casesfb3100dtest(real_ip): write unit tests covering all code branches of theutil-ipmodule593ccd0refactor(real_ip): use one-linetestify.assert.Panicsto capture intended panic in test case5d3681echore(real_ip): add module private variableUserRealIpHeaderCandidates38e1522doc(real_ip): write docstring for each function in theutils-ipmodule87e7a55chore(real_ip): choose more concrete and unambiguous name for test helper function📊 Changes
3 files changed (+447 additions, -2 deletions)
View changed files
📝
internal/webserver/server.go(+2 -2)➕
internal/webserver/utils_ip.go(+216 -0)➕
internal/webserver/utils_ip_test.go(+229 -0)📄 Description
Fix the problem that the system log cannot record the user's real connection IP when the system is deployed in the container or behind the reverse proxy. Details of implement as follow:
X-REAL-IPandX-Forwarded-Forheaders in turn. ( The code handles multiple comma-separated IP lists, that is, through multi-layer reverse proxy);Thank you for reviewing my code.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.