Repository navigation
Trust forwarded headers, clamp usage days and restart in one place - #21
Merged
Merged
Conversation
Behind the trusted proxy, X-Forwarded-For and X-Forwarded-Proto are now believed under the same rule as X-Forwarded-Host and the identity headers: the shared secret or a configured proxy address. The usage filter's days are clamped once, so the summary, its chart and the query cover the same period. Apply, rollback and Restart share one startHealthy. The new config is written before the router stops (it reads its config only at start), so a failed write leaves it running instead of stuck in "restarting". Fixes #20
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.
Fixes #20.
fromTrustedProxy/forwarded(header)inhttpapi/server.gobacksforwardedHost,clientIPandisHTTPS. All three now accept the shared secret or a configured proxy address, the same trust that names the user.auth.HasProxySecretis unexported, since nothing outsideauthneeds it.docs/install.mdupdated.Filter.days()clamps once, used by both the query andSummary.Days/fillDays.startHealthyreplacesrestart(ctx, config)and the copy insideApply. The config is written before the router stops (Switchyard has no hot reload), so a failed write returns with the router untouched; previously a failed first write left the state atrestarting.Tests
TestForwardedHeadersTrustedLikeIdentity: address- and secret-trusted proxies report client IP and scheme, while others are ignored.TestSummaryDaysMatchTheQuery: out-of-range days give 30-day summaries with 30 chart points.go vet ./...andgo test ./...pass.