Repository navigation
rsc-kit: set RSC_TRUST_FORWARDED=1, so requestClientIp() is the visitor's - #125
Merged
Merged
Conversation
…or's Unset, rsc-kit trusts no forwarded header and requestClientIp() is the host proxy's address for every visitor. homeport's proxy writes the visitor's address as the whole X-Forwarded-For (overwriting a visitor's own), so one hop is right: a managed value, added at the next build where the app has none of its own, as LOG_CHANNEL is for Laravel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without
RSC_TRUST_FORWARDED, rsc-kit believes no forwarded header, sorequestClientIp()returns the host proxy's address for every visitor. That breaks rate limits and anything else keyed on the visitor.homeport's proxy writes the visitor's address as the whole
X-Forwarded-For(one address, overwriting a visitor's own; docs/detection.md), so trusting one hop is right. rsc-kit counts hops from the right, so the value is1. The pair supervisor adds no hop, so a renderer beside a backend gets the same value.It's a managed value (
MakeValue, runtime), like Laravel'sLOG_CHANNEL=stderr: the control plane adds it at each build where the app has none of its own, so existing rsc-kit apps get it on their next deploy, and it's shown under Set by homeport for a new app. The bundle's.homeport/envcouldn't carry it, because an rsc-kit server ships as a binary.Reaches the control plane when its
go.modpin moves to the release with this.Tests first:
buildplan/managed_test.go(which apps get it, how it's made, its value).go test ./...andgo vetpass. docs/detection.md's visitor-IP section has an rsc-kit line.