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:
@ -62,7 +62,7 @@ func UpdateIndex() {
|
||||
}
|
||||
}
|
||||
|
||||
func Static(r *gin.Engine) {
|
||||
func Static(r *gin.RouterGroup, noRoute func(handlers ...gin.HandlerFunc)) {
|
||||
InitIndex()
|
||||
folders := []string{"assets", "images", "streamer", "static"}
|
||||
r.Use(func(c *gin.Context) {
|
||||
@ -81,7 +81,7 @@ func Static(r *gin.Engine) {
|
||||
r.StaticFS(fmt.Sprintf("/%s/", folders[i]), http.FS(sub))
|
||||
}
|
||||
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
noRoute(func(c *gin.Context) {
|
||||
c.Header("Content-Type", "text/html")
|
||||
c.Status(200)
|
||||
if strings.HasPrefix(c.Request.URL.Path, "/@manage") {
|
||||
|
Reference in New Issue
Block a user