from this commit, if you want reverse proxy to sub-directory like `alist` with `nginx`, you need config: ```nginx location /alist/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Range $http_range; proxy_set_header If-Range $http_if_range; proxy_redirect off; proxy_pass http://127.0.0.1:5244/alist/; # the max size of file to upload client_max_body_size 20000m; } ```
30 lines
649 B
Go
30 lines
649 B
Go
package static
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/alist-org/alist/v3/internal/conf"
|
|
"github.com/alist-org/alist/v3/pkg/utils"
|
|
)
|
|
|
|
type SiteConfig struct {
|
|
ApiURL string
|
|
BasePath string
|
|
Cdn string
|
|
}
|
|
|
|
func getSiteConfig() SiteConfig {
|
|
siteConfig := SiteConfig{
|
|
ApiURL: conf.Conf.SiteURL,
|
|
BasePath: conf.URL.Path,
|
|
Cdn: strings.ReplaceAll(strings.TrimSuffix(conf.Conf.Cdn, "/"), "$version", conf.WebVersion),
|
|
}
|
|
if siteConfig.BasePath != "" {
|
|
siteConfig.BasePath = utils.FixAndCleanPath(siteConfig.BasePath)
|
|
}
|
|
if siteConfig.Cdn == "" {
|
|
siteConfig.Cdn = strings.TrimSuffix(siteConfig.BasePath, "/")
|
|
}
|
|
return siteConfig
|
|
}
|