3

I am using next.js version 12 to deploy a webpage but when deployed it gives a warning in console

websocket.js?a9be:45 WebSocket connection to 'wss://eteaga.com/_next/webpack-hmr' failed:

In the localhost it doesn't give any warnings or problems. Is it the new version of next.js that needs some configuration added?

juliomalves
  • 42,130
  • 20
  • 150
  • 146
desarrollo 2
  • 31
  • 1
  • 3

1 Answers1

1

You have to define a new location block for websockets, & add the nginx configurations for upgrading the connection 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";

        }
Behnia FB
  • 53
  • 4