Skip to content

Version 1.15.0

Compare
Choose a tag to compare
@marjune163 marjune163 released this 22 Jul 15:22
· 262 commits to main since this release

Breaking changes

Remove --bind option

The purpose of providing --bind is to provide a possibility to align the behavior with Windows that path is case-insensitive.

Use --alias instead. It is now path-case-insensitive on Windows platform, while still case sensitive on unix like platform. Now it is impossible to use case-insensitive path alias on unix like platform.

Remove --base option

Use --prefix instead, it uses case-insensitive match on Windows platform.

Before:

  • Use --prefix for case-sensitive prefix for all platforms.
  • Use --base for case-insensitive prefix for all platforms.

After:

  • On Windows platform, --prefix matching is case-insensitive.
  • On non-Windows platform, --prefixmatching is case-sensitive.

Rename --header option to --global-header

--header in previous version is renamed to --global-header.
Now --header is used to customize response header for specified URL paths.(See "New features" section).

New features

Several path related options are now case insensitive for matching path on Windows

On windows platform, it is possible to access a file system path without case matched. Thus, following path options are now using case-insensitive match on Windows platform:

  • --upload
  • --upload-dir
  • --mkdir
  • --mkdir-dir
  • --delete
  • --delete-dir
  • --archive
  • --archive-dir
  • --cors
  • --cors-dir
  • --auth
  • --auth-dir

Add --header and --header-dir to customize response header for specified paths

--header <separator><url-path><separator><name><separator><value> ...

Add custom HTTP response header for a specific URL path(and sub path).

--header-dir <separator><fs-path><separator><name><separator><value> ...

Similar to --header, but use file system path instead of URL path.

Restrict access from third party host

Restrict access from third party host by detecting request header Referer or Origin.

Add --global-restrict-access [allow-host, ...] to restrict access for all url paths.

Add --restrict-access <sep><url-path>[<sep><allow-host>...] to restrict access for specific url paths.

Add --restrict-access-dir <sep><fs-path>[<sep><allow-host>...] to restrict access for specific file system paths.

If the request header is empty, directory list page is still allowed to access.

If allowed host is not specified, file content can only be accessed from current host. Note this will not help to restrict access from other one who point a domain to your host and could be matched to current virtual host, unless specifying the allowed host explicitly.

The "host" could be a hostname which means using a default port, or the form of "host:port".

Add --force-dir-slash option

Use this option to force redirect directory list page without "/" suffix in the URL to the URL with the suffix.


破坏性变更

移除--bind选项

提供--bind选项的目的是提供一种可能性,使路径匹配的行为与Windows系统保持一致,即不区分大小写。

请改用--alias。它现在在Windows平台上不区分大小写,而在类unix 的平台上仍然区分大小写。现在无法在类unix平台上使用不区分大小写的别名。

移除--base选项

请改用--prefix,它在Windows平台上使用不区分大小写的匹配。

之前:

  • 使用--prefix指定所有平台的区分大小写的服务前缀
  • 使用--base指定所有平台的不区分大小写的服务前缀

之后:

  • 在Widnows平台上,--prefix的匹配是不区分大小写的
  • 在非Widnows平台上,--prefix的匹配是区分大小写的

--header选项改名为--global-header

之前版本中的--header已重命名为--global-header
现在--header用于自定义指定URL路径的响应头(参见“新特性”部分)。

新特性

数个与路径有关的选项在Windows上匹配时不再区分大小写

在Windows平台上,可以访问大小写不匹配的文件系统路径。 因此,在Windows平台上,以下路径选项现在使用不区分大小写的匹配:

  • --upload
  • --upload-dir
  • --mkdir
  • --mkdir-dir
  • --delete
  • --delete-dir
  • --archive
  • --archive-dir
  • --cors
  • --cors-dir
  • --auth
  • --auth-dir

添加--header--header-dir来为指定的路径自定义响应头

--header <separator><url-path><separator><name><separator><value> ...

为指定的URL路径(及子路径)添加自定义HTTP响应头。

--header-dir <separator><fs-path><separator><name><separator><value> ...

与--header类似 ,但使用文件系统路径而不是URL路径。

限制来自第三方主机的访问

限制来自第三方主机用户的访问,它是通过检测请求头中的RefererOrigin实现的。

添加--global-restrict-access [allow-host, ...]对所有URL施加访问限制。

添加--restrict-access <sep><url-path>[<sep><allow-host>...]对指定的URL路径施加访问限制。

添加--restrict-access-dir <sep><fs-path>[<sep><allow-host>...]对指定的文件系统路径施加访问限制。

如果请求头为空,仍然允许访问目录列表页。

如果未指定允许的第三方主机,文件内容仅可被当前主机访问。注意这样无法限制把域名指向你的主机且能匹配当前虚拟主机的人,除非明确指定允许的主机。

“主机”可以是主机名,即使用默认端口,也可以是“主机:端口”的形式。

添加--force-dir-slash选项

使用此选项强制将URL中不带“/”后缀的目录列表页重定向到带后缀的URL。