Skip to content

Commit 1b0758a

Browse files
author
mirkobrombin
committed
feat: allow empty RootDirectory for proxying requests to other servers
1 parent 15a673d commit 1b0758a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/server/server.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ func startSingleServer(conf config.SiteConfig, mwManager *middleware.MiddlewareM
113113
// We do not want to start a server if the root directory does not exist
114114
// let's fail fast instead.
115115
if conf.ProxyPass == "" {
116-
if _, err := os.Stat(conf.RootDirectory); os.IsNotExist(err) {
117-
logger.Errorf("Root directory does not exist for %s: %v", conf.Domain, err)
118-
return
116+
// Here we allow empty paths as RootDirectory, this is useful for
117+
// proxying requests to other servers by default, like Flask apps.
118+
if conf.RootDirectory != "" {
119+
if _, err := os.Stat(conf.RootDirectory); os.IsNotExist(err) {
120+
logger.Errorf("Root directory does not exist for %s: %v", conf.Domain, err)
121+
return
122+
}
119123
}
120124
}
121125

0 commit comments

Comments
 (0)