Skip to content

dont count dt4a toward rate limit #2219

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions ee/localserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ func New(ctx context.Context, k types.Knapsack, presenceDetector presenceDetecto

mux := http.NewServeMux()
mux.HandleFunc("/", http.NotFound)
mux.Handle("/v0/cmd", ecKryptoMiddleware.Wrap(ecAuthedMux))
mux.Handle("/v0/cmd", ls.rateLimitHandler(ecKryptoMiddleware.Wrap(ecAuthedMux)))

// /v1/cmd was added after fixing a bug where local server would panic when an endpoint was not found
// after making it through the kryptoEcMiddleware
// by using v1, k2 can call endpoints without fear of panicing local server
// /v0/cmd left for transition period
mux.Handle("/v1/cmd", ecKryptoMiddleware.Wrap(ecAuthedMux))
mux.Handle("/v1/cmd", ls.rateLimitHandler(ecKryptoMiddleware.Wrap(ecAuthedMux)))

trustedDt4aKeys, err := dt4aKeys()
if err != nil {
Expand Down Expand Up @@ -142,9 +142,7 @@ func New(ctx context.Context, k types.Knapsack, presenceDetector presenceDetecto
Handler: otelhttp.NewHandler(
ls.requestLoggingHandler(
ls.preflightCorsHandler(
ls.rateLimitHandler(
mux,
),
mux,
)), "localserver", otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string {
return r.URL.Path
})),
Expand Down
Loading