Skip to content

fix(remix): Attempt to extract user IP from request headers. - #6263

Merged
AbhiPrasad merged 3 commits into
masterfrom
onur/remix-extract-user-id
Nov 24, 2022
Merged

fix(remix): Attempt to extract user IP from request headers.#6263
AbhiPrasad merged 3 commits into
masterfrom
onur/remix-extract-user-id

Conversation

@onurtemizkan

@onurtemizkanonurtemizkan commented Nov 22, 2022

Copy link
Copy Markdown
Contributor

Ref: #6139 - #6139 (comment)

Remix requests don't contain client IP addresses in req.ip or req.socket.*.
To extract them, we need to iterate over a set of request headers that may contain that info.

I have vendored / modified an implementation of that function from third-party utility set remix-utils. (Using as a dependency is not possible because of incompatible TS syntax.)

It's still the best effort and may also need improvements over header key prioritization.

@github-actions

github-actionsBot commented Nov 22, 2022

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
@sentry/browser - ES5 CDN Bundle (gzipped + minified)19.5 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified)60.29 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified)18.16 KB (-0.02% 🔽)
@sentry/browser - ES6 CDN Bundle (minified)53.63 KB (0%)
@sentry/browser - Webpack (gzipped + minified)19.9 KB (0%)
@sentry/browser - Webpack (minified)65.12 KB (0%)
@sentry/react - Webpack (gzipped + minified)19.92 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified)45.93 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified)26.37 KB (0%)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified)24.78 KB (+0.01% 🔺)

@onurtemizkanonurtemizkan linked an issue Nov 23, 2022 that may be closed by this pull request
3 tasks

@lobsterkatielobsterkatie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

Comment threadpackages/remix/src/utils/getIpAddress.ts Outdated
Co-authored-by: Katie Byers <katie.byers@sentry.io>
@AbhiPrasad
AbhiPrasad enabled auto-merge (squash) November 24, 2022 10:20
@AbhiPrasad
AbhiPrasad merged commit b52336b into masterNov 24, 2022
@AbhiPrasad
AbhiPrasad deleted the onur/remix-extract-user-id branch November 24, 2022 12:32
Sign up for freeto 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.

Remix - No URL included with issues

3 participants

@onurtemizkan@lobsterkatie@AbhiPrasad