Skip to content

Bug: 新版Vite导致公网部署的Koishi在开发模式下默认无法以域名访问 #1492

@XNORIGC

Description

@XNORIGC

Describe the bug

开发模式Koishi使用了Vite,而新版Vite(6.0.9)引入了server.allowedHosts配置,默认情况下,仅允许localhost响应请求,因此以别的域名访问Koishi时只有白屏。打开控制台发现尝试加载文件但得到了403错误,访问错误对应的URL,提示Blocked request.等内容。

Steps to reproduce

用Yarn部署Koishi(yarn create koishi
修改koishi.ymlserver部分加上host: 0.0.0.0
开发模式启动Koishi(yarn dev
日志正常无报错,打开浏览器用域名访问Koishi,出现白屏。

Expected behavior

应能正常访问Koishi。

Screenshots

Image
Image

Versions

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (4) arm64 Neoverse-N1

Binaries:
    Node: 20.17.0
    Yarn: 4.5.3

Koishi:
    Core: 4.18.7
    Console: 5.30.7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions