4

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?

Alex
  • 8,908
  • 28
  • 103
  • 157

3 Answers3

2

This might be the issue, it worked for me

https://howchoo.com/chrome/stop-chrome-from-automatically-redirecting-https

If you ever visited the https version of a website (whether it resolved or not), Google Chrome might repeatedly send you to that version

hi-ren
  • 66
  • 1
  • 5
1

https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck

using cli

webpack-dev-server --disable-host-check

or in webpack config

devServer: {
        disableHostCheck: true
    }
Alex
  • 8,908
  • 28
  • 103
  • 157
0

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

Tomeg
  • 5,549
  • 2
  • 14
  • 9