Webpack log errors "net::ERR_SSL_PROTOCOL_ERROR" by calling sockjs-node/info

Viewed 2393

on front I use react on back .net core 3.1

on client I use webpack that is runned on localhost:8080

in Startup.cs I use proxyToSpa

 applicationBuilder.UseSpa(spa =>
                {
                    spa.UseProxyToSpaDevelopmentServer("http://localhost:8080/");
                });

on HTTP works as expected without any errors but on HTTPS I saw a lot of console errors and failed requests in Network there is failed requests for (sockjs-node/info?t=...) with error net::ERR_SSL_PROTOCOL_ERROR

enter image description here enter image description here

Is there any options to configure webpack or .net core project to avoid these error logs on HTTPS?

3 Answers

My main site was using https (reverse proxy to development server), so definining public: http://... didn't help for my development server, because the browser forced https (as the main site was https to).

What helped me was using https in the devServer too: https://stackoverflow.com/a/29772748/3279070

It was important that devServer HTTPS was signed with a good certificate like the main site was (the reverse proxy) and uses a hostname (public property) signed by the cert. So for example typical scenario is using the same certificate files and the same hostname (public: 'https://hostname:8081') as the main site

Related