Hot swap stops working when you enable HTTPS
Troubleshooting development mode Your project worked like a dream. then I try to modify it to run in HTTPS--first editing the product properties to be HTTPS in Visual Studio, using the recommended https: port number.
Eventually I found this https://github.com/aspnet/Home/issues/1486, added the right extra references into the Startup.cs file, and now I can run https: at whatever port I want, but the hot swap recompilation stopped working.
I recreated the project from scratch. As soon as I uncomment the two commented lines below (Startup.cs), web site works fine, but hot module swap stops functioning. .UseKestrel(options => { var serverCertificate = LoadCertificate(); //options.UseHttps(serverCertificate); })
//.UseUrls("https://localhost:5001")
HotModuleReplacement is being ran in http, and you have .net on https. You need to run webpack-Dev-server with --https, but I'm not sure if aspnet-webpack is setup to currently handle that situation. Steve would know best!
Thanks, Mark. This code is using the AspNetCore's UseWebpackDevMiddleware. When you look at the source code for it, line 17 hard-codes that to http. Seems like that may be my issue. Please let me know if you think I should look elsewhere. Otherwise, I'll submit this issue to that team.
13 namespace Microsoft.AspNetCore.Builder 14 { 15 public static class WebpackDevMiddleware 16 { 17 private const string WebpackDevMiddlewareScheme = "http"; 18 private const string WebpackHotMiddlewareEndpoint = "/__webpack_hmr"; 19 private const string DefaultConfigFile = "webpack.config.js";
Ahh nice catch, didn't have a chance to look last night.
Yes it looks like we need to add a new option to WebpackDevMiddlewareOptions for https. Let me give it a test run and see if I can get it all working before putting in a fix.
Should be all set with PR #272
Thanks, Mark, I’ll try it out over the weekend. George
From: Mark Pieszak [mailto:[email protected]] Sent: Friday, August 19, 2016 10:31 AM To: aspnet/JavaScriptServices [email protected] Cc: George Langdon [email protected]; Author [email protected] Subject: Re: [aspnet/JavaScriptServices] Hot swap stops working when you enable HTTPS (#271)
Should be all set with PR #272https://github.com/aspnet/JavaScriptServices/pull/272
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/JavaScriptServices/issues/271#issuecomment-241034304, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AORU4ykSlPZrAWsMKGzl_RN_Rr_UiHzjks5qhb4xgaJpZM4JoDpu.
This is now fixed. Now, the HMR integration handles /__webpack_hmr requests by reverse-proxying them, instead of 302-redirecting, to the underlying Node service. That means it's independent of what scheme/hostname/etc the browser is connecting on, because the browser never sees the Node HMR service directly any more.
To get this fix, upgrade to a newer version of Microsoft.AspNetCore.SpaServices. However I haven't yet published this update to NuGet - will do so shortly.
Update: The newer Microsoft.AspNetCore.SpaServices (and related packages) is now published to NuGet
Thanks! NOW I'll try it over the weekend.
Unfortunately I've had to revert the change that fixed this, because of issues with long-running requests triggering ECANCELED/EPIPE broken pipe errors.
I've submitted a repro to the Kestrel repo and will hopefully put in a better event-stream proxying implementation here once they let me know what (if anything) is the supported way to do this.
Thanks for the heads up.
Any progress considering this issue?
It looks like core 1.1 will have part of the fix in it when it comes out (if I understood the kestrel thread right). @boban984
Thanks!
From: Steve Sanderson [mailto:[email protected]] Sent: Wednesday, November 30, 2016 11:56 AM To: aspnet/JavaScriptServices [email protected] Cc: George Langdon [email protected]; Author [email protected] Subject: Re: [aspnet/JavaScriptServices] Hot swap stops working when you enable HTTPS (#271)
Closed #271https://github.com/aspnet/JavaScriptServices/issues/271 via e2f8031https://github.com/aspnet/JavaScriptServices/commit/e2f8031bb8e807f713733d6a641a84b895bfdfcb.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/JavaScriptServices/issues/271#event-877167410, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AORU4--KCs21QEFbDIEZ3EGUOJdrRYpXks5rDaq6gaJpZM4JoDpu.