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

IIS Express + SSL certificate for localhost + HMR #482

Closed
ghost opened this issue Dec 1, 2016 · 5 comments
Closed

IIS Express + SSL certificate for localhost + HMR #482

ghost opened this issue Dec 1, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Dec 1, 2016

Hi guys,

So i have an ASP.NET Core app that is running on 'https://localhost:44328/home' that is currently specified in launchSettings.json.

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:44328/",
      "sslPort": 44328
    }
    ....
}

What i currently have:

           app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true,                
                    ConfigFile = "config/webpack.config.js"
                });

My problem:

Is there a way to specify that you want to get the hmr server to run over https?

image

@ghost
Copy link
Author

ghost commented Dec 1, 2016

I was able to find the following comment after some search:
// Also note that the webpack HMR service always uses HTTP, even if your app server uses HTTPS,
// because the HMR service has no need for HTTPS (the client doesn't see it directly - all traffic
// to it is proxied), and the HMR service couldn't use HTTPS anyway (in general it wouldn't have
// the necessary certificate).

https://github.com/aspnet/JavaScriptServices/blob/dev/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddleware.cs

So if this is the wanted behavior, we can close this issue, and it will probably remain here as a reference for further mates that are trying to achieve this.

@SteveSandersonMS
Copy link
Member

As it happens, this was fixed yesterday :) The latest package (SpaServices 1.1.0-beta-000002) proxies the /__webpack_hmr requests through the same connection that your browser is making to your ASP.NET site, so it works just the same whether you're using HTTP or HTTPS.

Note that to update to 1.1.0-beta-000002, you will also need to update to ASP.NET Core 1.1.0.

@ghost
Copy link
Author

ghost commented Dec 7, 2016

Hi @SteveSandersonMS,

I updated the application to ASP.NET Core 1.1.0 and the package to 1.1.0-beta-000002, but the problem still persists.

Example request (for vendor resource, but all traffic is via https):
image

The initialization code for webpack dev middleware remained the same:

   app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true,                
                    ConfigFile = "config/webpack.config.js"
                });

@SteveSandersonMS
Copy link
Member

What version of aspnet-webpack are you on? You need 1.0.25 or later to get this feature. Sorry I didn't mention that in my previous comment.

@ghost
Copy link
Author

ghost commented Dec 8, 2016

I was on 1.0.24. I updated the package to 1.0.25 and now works as expected. Thanks a lot for wasting some time for helping me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant