我正在使用next.js版本12来部署网页,但部署时它会在控制台中给出警告websocket.js?a9 be:45 WebSocket连接到'wss://eteaga.com/_next/webpack-hmr'失败:在localhost中,它不会给予任何警告或问题。是新版本的next.js需要添加一些配置吗?
c86crjj01#
你需要为websockets定义一个新的location block,并添加nginx配置来升级连接there:
location /_next/webpack-hmr { # I assumed my server is running on port 3000 on localhost proxy_pass http://localhost:3000/_next/webpack-hmr; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
字符串
1条答案
按热度按时间c86crjj01#
你需要为websockets定义一个新的location block,并添加nginx配置来升级连接there:
字符串