Skip to content

Commit 900709b

Browse files
committed
Attach rate limiter outside the pkg
1 parent 70309ce commit 900709b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

coderd/coderd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ func New(options *Options) *API {
404404
r.Get("/healthz", func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte("OK")) })
405405

406406
// Attach workspace apps routes.
407-
workspaceAppServer.Attach(r, apiRateLimiter)
407+
r.Group(func(r chi.Router) {
408+
r.Use(apiKeyMiddleware)
409+
workspaceAppServer.Attach(r)
410+
})
408411

409412
r.Route("/derp", func(r chi.Router) {
410413
r.Get("/", derpHandler.ServeHTTP)

coderd/workspaceapps/proxy.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ type Server struct {
8686
AppSigningKey SigningKey
8787
}
8888

89-
func (s *Server) Attach(r chi.Router, pathAppRateLimiter func(http.Handler) http.Handler) {
89+
func (s *Server) Attach(r chi.Router) {
9090
servePathApps := func(r chi.Router) {
91-
r.Use(pathAppRateLimiter)
9291
r.HandleFunc("/*", s.workspaceAppsProxyPath)
9392
}
9493

0 commit comments

Comments
 (0)