Skip to content

修复青龙面板无法通过 IPv6 访问的问题(监听地址需从 0.0.0.0改为 ::) #2972

@MingTechpro

Description

@MingTechpro

Clear and concise description of the problem

在新版青龙面板中,HTTP 服务默认仅监听 IPv4 地址 (0.0.0.0),导致无法通过 IPv6 访问面板。需修改监听地址为 IPv6 通配符 ::(兼容 IPv4/IPv6 双栈)。

复现步骤

1.部署最新版青龙面板(Docker 环境)
2.尝试通过服务器的 IPv6 地址访问面板(如 http://[xxxx:xxxx::xxxx]:端口)
3.连接失败(超时或无响应)

原因分析

文件 /ql/static/build/services/http.js第 11 行硬编码了 IPv4 监听地址:

this.server = expressApp.listen(port, '0.0.0.0', () => { ... })

'0.0.0.0' 仅绑定 IPv4,忽略 IPv6 请求。

Suggested solution

解决方案

进入 Docker 容器修改 http.js

docker exec -it qinglong vi /ql/static/build/services/http.js

修改监听地址为 IPv6 通配符 ::(自动兼容 IPv4/IPv6):

- this.server = expressApp.listen(port, '0.0.0.0', () => {
+ this.server = expressApp.listen(port, '::', () => {

修改后的完整代码块(参考)

try {                                                           
            return new Promise((resolve, reject) => {                   
                var _a;                                        
                this.server = expressApp.listen(port, '::', () => {
                    logger_1.default.debug(`...... HTTP service started successfully`);
                    metrics_1.metricsService.record('http_service_start', 1, {         
                        port: port.toString(),                                         
                    });                                                                
                    resolve(this.server);                                              
                });                                                                    
                (_a = this.server) === null || _a === void 0 ? void 0 : _a.on('error', (err) =>
                    logger_1.default.error('Failed to start HTTP service:', err);              
                    reject(err);                                                               
                });                                                                            
            });                                                                                
        }

Alternative

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions