angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.98k forks source link

Development server loses self-signed certificate #26298

Closed Fab1anB closed 11 months ago

Fab1anB commented 11 months ago

Command

serve

Is this a regression?

The previous version in which this bug was not present was

Angular v16

Description

I have an HTTPS project with a self-signed certificate. If I load the Angular SPA, I accept the certificate in the browser (Chrome). The website now works for a short time. After a few seconds, the browser loses the certificate and you have to accept it again. Lazy modules are not loaded anymore. In the example project you have to reload the page to see the problem.

The following steps have not brought any improvement:

Minimal Reproduction

Github project for reproduction

I have done the following steps:

Exception or Error

app-routing.module.ts:73 GET https://localhost:4200/cameras.module-FLNCHSAM.js net::ERR_CERT_AUTHORITY_INVALID
(...)
app-routing.module.ts:73 ERROR TypeError: Failed to fetch dynamically imported module: https://localhost:4200/cameras.module-FLNCHSAM.js

Your Environment

Angular CLI: 17.0.0
Node: 20.9.0
Package Manager: npm 10.1.0
OS: win32 x64

Angular: 17.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0
@angular-devkit/build-angular   17.0.0
@angular-devkit/core            17.0.0
@angular-devkit/schematics      17.0.0
@angular/cli                    17.0.0
@schematics/angular             17.0.0
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Anything else relevant?

Google Chrome Version 119.0.6045.107 (Offizieller Build) (64-Bit)

alan-agius4 commented 11 months ago

Hi @Fab1anB, I am unable to replicate this with the reproduction provided.

It's worth mentioning that the Angular CLI is does not create/manage self-signed certificates as these are generated by Vite and Webpack-dev-server.

Fab1anB commented 11 months ago

Thank your for your response @alan-agius4. I gave it another try with the repository I provided. The effect took longer, but I got the same problem after waiting two minutes and pressing F5 (refresh).

The webpack-dev-server dependency of @angular-devkit/build-angular just had minor update ( '4.15.0' to '4.15.1') between Angular16 and Angular17

However if you are sure it has nothing to do with angular-cli then I will open an issue there. I just wondered how both vite-server and webpack-server create the same problem.

alan-agius4 commented 11 months ago

Hi @Fab1anB,

It happens that I left the app running and after 42 minutes I am still not able to replicate the issue. Can you check the expiry of the self signed certificate? I also would suggest that you try to run the app in incognito mode and see if the issue persist.

It is indeed strange the both vite dev-server and webpack-dev-server result on the same broken result, for this case I suspect it's more of a local environment issue.

Fab1anB commented 11 months ago

It looks like you are right @alan-agius4 at least with my MacBook I could not reproduce this issue as well. I will try it again on other computer for some times and close the issue then.

Thank you for your time and effort.

Fab1anB commented 11 months ago

I found the problem. It has nothing to do with angular cli. Google Chrome received an update, where they removed the "allow-insecure-localhost"-flag as of Chrome 119.

As others got the same problem maybe it helps someone when he accidentally comes over this page. See more here: https://support.google.com/chrome/thread/241869686/allow-insecure-localhost-has-been-removed-as-of-chrome-119?hl=en

angular-automatic-lock-bot[bot] commented 10 months ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.