-
Notifications
You must be signed in to change notification settings - Fork 887
feat: Support x-forwarded-for headers for IPs #4684
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
Conversation
2410a20
to
d1c9711
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level, looks good to me
@@ -321,6 +322,11 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code | |||
} | |||
} | |||
|
|||
realIPConfig, err := httpmw.ParseRealIPConfig(dflags.ProxyTrustedHeaders.Value, dflags.ProxyTrustedOrigins.Value) | |||
if err != nil { | |||
return xerrors.Errorf("parse real ip config: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: will a use know what real ip config
means here? wondering if we can make that friendlier
coderd/httpmw/realip.go
Outdated
headerXForwardedProto, | ||
} | ||
|
||
// Config configures the search order for the function, which controls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impressed with all the comments throughout this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jonathan wrote this originally I believe :D
Fixes #4430.
This mostly copies in code from v1, and adds a few tests.