Apache反向代理SSL配置下Node-RED频繁断连问题排查求助
Apache反向代理SSL环境下Node-RED UI频繁断开重连问题排查
环境信息
- Node-RED本地运行在
http://localhost:1880 - Apache作为反向代理,将公域
https://iot.example.com的请求转发至Node-RED - Apache已配置SSL/TLS处理HTTPS请求
问题表现
通过公域访问Node-RED UI时,页面可初始加载,但频繁弹出**"Lost connection to server, reconnecting"**提示并尝试重连。
Apache错误日志异常记录
[Tue Mar 12 01:46:59.958983 2024] [socache_shmcb:debug] [pid 9299] mod_socache_shmcb.c(508): AH00831: socache_shmcb_store (0x21 -> subcache 1) [Tue Mar 12 01:46:59.959094 2024] [socache_shmcb:debug] [pid 9299] mod_socache_shmcb.c(862): AH00847: insert happened at idx=0, data=(0:32) [Tue Mar 12 01:46:59.959114 2024] [socache_shmcb:debug] [pid 9299] mod_socache_shmcb.c(865): AH00848: finished insert, subcache: idx_pos/idx_used=0/1, data_pos/data_used=0/212 [Tue Mar 12 01:46:59.959132 2024] [socache_shmcb:debug] [pid 9299] mod_socache_shmcb.c(530): AH00834: leaving socache_shmcb_store successfully [Tue Mar 12 01:46:59.960120 2024] [ssl:debug] [pid 9299] ssl_engine_kernel.c(415): [client 74.12.48.208:2255] AH02034: Initial (No.1) HTTPS request received for child 2 (server iot.example.com:443) [Tue Mar 12 01:46:59.960214 2024] [authz_core:debug] [pid 9299] mod_authz_core.c(843): [client 74.12.48.208:2255] AH01628: authorization result: granted (no directives) [Tue Mar 12 01:46:59.960309 2024] [proxy:debug] [pid 9299] mod_proxy.c(1503): [client 74.12.48.208:2255] AH01143: Running scheme http handler (attempt 0) [Tue Mar 12 01:46:59.960333 2024] [proxy:debug] [pid 9299] proxy_util.c(2531): AH00942: http: has acquired connection for (localhost) [Tue Mar 12 01:46:59.960355 2024] [proxy:debug] [pid 9299] proxy_util.c(2587): [client 74.12.48.208:2255] AH00944: connecting http://localhost:1880/comms to localhost:1880 [Tue Mar 12 01:46:59.960376 2024] [proxy:debug] [pid 9299] proxy_util.c(2810): [client 74.12.48.208:2255] AH00947: connected /comms to localhost:1880 [Tue Mar 12 01:46:59.960726 2024] [proxy:debug] [pid 9299] proxy_util.c(3111): AH00951: http: backend socket is disconnected. [Tue Mar 12 01:46:59.961074 2024] [proxy:debug] [pid 9299] proxy_util.c(3267): (111)Connection refused: AH00957: http: attempt to connect to [::1]:1880 (localhost) failed [Tue Mar 12 01:46:59.962089 2024] [proxy:debug] [pid 9299] proxy_util.c(3276): AH02824: http: connection established with 127.0.0.1:1880 (localhost) [Tue Mar 12 01:46:59.962192 2024] [proxy:debug] [pid 9299] proxy_util.c(3462): AH00962: http: connection complete to [::1]:1880 (localhost) [Tue Mar 12 01:46:59.965368 2024] [proxy:debug] [pid 9299] proxy_util.c(2546): AH00943: http: has released connection for (localhost) [Tue Mar 12 01:47:00.007071 2024] [ssl:info] [pid 9299] SSL Library Error: error:0A000126:SSL routines::unexpected eof while reading [Tue Mar 12 01:47:00.007147 2024] [ssl:info] [pid 9299] [client 74.12.48.208:2255] AH01998: Connection closed to child 2 with abortive shutdown (server iot.example.com:443)
已确认事项
- Node-RED在
http://localhost:1880可正常访问 - Apache SSL配置正确
- Apache与Node-RED间无防火墙限制
相关配置文件
Apache代理配置
<VirtualHost *:443> ServerName iot.example.com ServerAdmin webmaster@example.com DocumentRoot /var/www/html/IoT SSLProxyEngine On ProxyPreserveHost On ProxyRequests Off ProxyPass /comms wss://localhost:1880/comms/ disablereuse=On ProxyPass / http://localhost:1880/ ProxyPassReverse /comms wss://localhost:1880/comms/ ProxyPassReverse / http://localhost:1880/ Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" ErrorLog ${APACHE_LOG_DIR}/IoT.log CustomLog ${APACHE_LOG_DIR}/IoT_access.log combined SSLEngine on SSLCertificateFile /root/.acme.sh/iot.example.com_ecc/fullchain.cer SSLCertificateKeyFile /root/.acme.sh/safwanshaib.com_ecc/iot.example.com.key </VirtualHost>
Node-RED settings.js配置
module.exports = { flowFile: 'flows.json', flowFilePretty: true, uiPort: process.env.PORT || 1880, diagnostics: { enabled: true, ui: true, }, runtimeState: { enabled: false, ui: false, }, logging: { console: { level: "info", metrics: false, audit: false } }, exportGlobalContextKeys: false, externalModules: { }, editorTheme: { palette: { }, projects: { enabled: false, workflow: { mode: "manual" } }, codeEditor: { lib: "monaco", options: { } }, markdownEditor: { mermaid: { enabled: true } }, }, functionExternalModules: true, functionTimeout: 0, functionGlobalContext: { }, ui: { httpRoot: '/', httpAdminRoot: '/', }, debugMaxLength: 1000, mqttReconnectTime: 15000, serialReconnectTime: 15000, }
已尝试的操作
- 更新系统包及Node.js,问题未解决
请求帮助
请问该问题的原因是什么?如何排查并解决?恳请提供思路与建议。
内容的提问来源于stack exchange,提问作者safwan shaib
相关产品推荐
相关产品推荐

