small bug fixes
This commit is contained in:
@@ -70,12 +70,20 @@ func Parse(c *caddy.Controller) ([]Config, error) {
|
||||
Regexp: regexp.MustCompile("\\/\\..+"),
|
||||
}}
|
||||
|
||||
// Get the baseURL
|
||||
args := c.RemainingArgs()
|
||||
|
||||
if len(args) > 0 {
|
||||
cfg.BaseURL = args[0]
|
||||
}
|
||||
|
||||
// Set the first user, the global user
|
||||
user = cfg.User
|
||||
|
||||
for c.NextBlock() {
|
||||
switch c.Val() {
|
||||
case "on":
|
||||
// NOTE: DEPRECATED
|
||||
if !c.NextArg() {
|
||||
return configs, c.ArgErr()
|
||||
}
|
||||
@@ -212,6 +220,10 @@ func Parse(c *caddy.Controller) ([]Config, error) {
|
||||
cfg.BaseURL = strings.TrimSuffix(cfg.BaseURL, "/")
|
||||
cfg.BaseURL = "/" + cfg.BaseURL
|
||||
|
||||
if cfg.BaseURL == "/" {
|
||||
cfg.BaseURL = ""
|
||||
}
|
||||
|
||||
caddyConf := httpserver.GetConfig(c)
|
||||
cfg.AbsoluteURL = strings.TrimSuffix(caddyConf.Addr.Path, "/") + "/" + cfg.BaseURL
|
||||
cfg.AbsoluteURL = strings.Replace(cfg.AbsoluteURL, "//", "/", -1)
|
||||
|
||||
Reference in New Issue
Block a user