fix!: reverse proxy to sub-directory (#3483)
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; } ```
This commit is contained in:
@ -3,7 +3,9 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/alist-org/alist/v3/internal/conf"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/op"
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
@ -14,17 +16,14 @@ import (
|
||||
|
||||
var handler *webdav.Handler
|
||||
|
||||
func init() {
|
||||
func WebDav(dav *gin.RouterGroup) {
|
||||
handler = &webdav.Handler{
|
||||
Prefix: "/dav",
|
||||
Prefix: path.Join(conf.URL.Path, "/dav"),
|
||||
LockSystem: webdav.NewMemLS(),
|
||||
Logger: func(request *http.Request, err error) {
|
||||
log.Errorf("%s %s %+v", request.Method, request.URL.Path, err)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func WebDav(dav *gin.RouterGroup) {
|
||||
dav.Use(WebDAVAuth)
|
||||
dav.Any("/*path", ServeWebDAV)
|
||||
dav.Any("", ServeWebDAV)
|
||||
|
Reference in New Issue
Block a user