1
0
Fork 0

Refuse recursive requests

Co-authored-by: Michael <michael.matur@gmail.com>
This commit is contained in:
Romain 2023-11-21 15:08:06 +01:00 committed by GitHub
parent 088fe3c270
commit 186e3e1541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 519 additions and 243 deletions

View file

@ -349,7 +349,7 @@ func BuildTCPRouterConfiguration(ctx context.Context, configuration *dynamic.TCP
continue
}
if len(router.Service) == 0 {
if router.Service == "" {
if len(configuration.Services) > 1 {
delete(configuration.Routers, routerName)
loggerRouter.
@ -368,7 +368,7 @@ func BuildTCPRouterConfiguration(ctx context.Context, configuration *dynamic.TCP
func BuildUDPRouterConfiguration(ctx context.Context, configuration *dynamic.UDPConfiguration) {
for routerName, router := range configuration.Routers {
loggerRouter := log.FromContext(ctx).WithField(log.RouterName, routerName)
if len(router.Service) > 0 {
if router.Service != "" {
continue
}
@ -413,9 +413,12 @@ func BuildRouterConfiguration(ctx context.Context, configuration *dynamic.HTTPCo
delete(configuration.Routers, routerName)
continue
}
// Flag default rule routers to add the denyRouterRecursion middleware.
router.DefaultRule = true
}
if len(router.Service) == 0 {
if router.Service == "" {
if len(configuration.Services) > 1 {
delete(configuration.Routers, routerName)
loggerRouter.