Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Hot swap stops working when you enable HTTPS #271

Closed

Description

@glangdonvt

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 dotnet/aspnetcore#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")

Activity

  1. MarkPieszak commented on Aug 19, 2016

    @MarkPieszak
    Contributor

    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!

  2. glangdonvt commented on Aug 19, 2016

    @glangdonvt
    Author

    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";

  3. MarkPieszak commented on Aug 19, 2016

    @MarkPieszak
    Contributor

    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.

  4. MarkPieszak commented on Aug 19, 2016

    @MarkPieszak
    Contributor

    Should be all set with PR #272

  5. glangdonvt commented on Aug 19, 2016

    @glangdonvt
    Author

    Thanks, Mark, I’ll try it out over the weekend.
    George

    From: Mark Pieszak [mailto:notifications@github.com]
    Sent: Friday, August 19, 2016 10:31 AM
    To: aspnet/JavaScriptServices JavaScriptServices@noreply.github.com
    Cc: George Langdon george@rcxrules.com; Author author@noreply.github.com
    Subject: Re: [aspnet/JavaScriptServices] Hot swap stops working when you enable HTTPS (#271)

    Should be all set with PR #272#272

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHubhttps://github.com//issues/271#issuecomment-241034304, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AORU4ykSlPZrAWsMKGzl_RN_Rr_UiHzjks5qhb4xgaJpZM4JoDpu.

  6. SteveSandersonMS commented on Sep 9, 2016

    @SteveSandersonMS
    Member

    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.

  7. SteveSandersonMS commented on Sep 9, 2016

    @SteveSandersonMS
    Member

    Update: The newer Microsoft.AspNetCore.SpaServices (and related packages) is now published to NuGet

  8. glangdonvt commented on Sep 9, 2016

    @glangdonvt
    Author

    Thanks! NOW I'll try it over the weekend.

  9. SteveSandersonMS commented on Sep 13, 2016

    @SteveSandersonMS
    Member

    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.

  10. glangdonvt commented on Sep 13, 2016

    @glangdonvt
    Author

    Thanks for the heads up.

  11. boban100janovski commented on Oct 20, 2016

    @boban100janovski

    Any progress considering this issue?

  12. MarkPieszak commented on Oct 20, 2016

    @MarkPieszak
    Contributor

    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

  13. glangdonvt commented on Nov 30, 2016

    @glangdonvt
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions