Skip to content

Commit ff7e000

Browse files
authored
Merge pull request #2852 from gobitfly/NOBIDS/do-not-ratelimit-apidocs
(NOBIDS) do not ratelimit api-docs and internal api per default
2 parents d745f50 + 597df05 commit ff7e000

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/misc/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,15 @@ func disableUserPerEmail() error {
415415
if opts.Email == "" {
416416
return errors.New("no email specified")
417417
}
418+
419+
if utils.Config.Frontend.SessionSecret == "" {
420+
return fmt.Errorf("session secret is empty, please provide a secure random string")
421+
}
422+
423+
logrus.Infof("initializing session store: %v", utils.Config.RedisSessionStoreEndpoint)
424+
425+
utils.InitSessionStore(utils.Config.Frontend.SessionSecret)
426+
418427
user := struct {
419428
ID uint64 `db:"id"`
420429
Email string `db:"email"`

ratelimit/ratelimit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (r *responseWriterDelegator) Status() int {
183183
}
184184

185185
var DefaultRequestFilter = func(req *http.Request) bool {
186-
if req.URL == nil || !strings.HasPrefix(req.URL.Path, "/api") {
186+
if req.URL == nil || !strings.HasPrefix(req.URL.Path, "/api") || strings.HasPrefix(req.URL.Path, "/api/i/") || strings.HasPrefix(req.URL.Path, "/api/v1/docs/") || strings.HasPrefix(req.URL.Path, "/api/v2/docs/") {
187187
return false
188188
}
189189
return true

0 commit comments

Comments
 (0)