Skip to content

[BUG] - Node 18 - ng serve - something has changed in Node v18 #24442

Closed as not planned
@nawlbergs

Description

@nawlbergs

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

Not sure if this is an issue with Angular or webpack-dev-server... but here goes:

I use a docker apache proxy locally so my dev env is more like production: www.myapp.local instead of localhost:4200
But when I try to bump node up to v18... the angular proxy falls apart and does not work. The node api proxy works fine, its just the angular connection that breaks.

I start node like this

$ npx ng serve --hmr --disable-host-check --port 4200 --public-host=www.myapp.local --project=myapp

host file (pretty typical)

127.0.0.1 www.myapp.local // <-- my app
...  
# Added by Docker Desktop
10.0.0.225 host.docker.internal
10.0.0.225 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

my docker apache (nothing crazy here): FROM php:5.6-apache

Define local_node "http://host.docker.internal:3333"
Define local_app "http://host.docker.internal:4200"

<VirtualHost *:80>
  DocumentRoot "/var/www/html"
  DirectoryIndex index.php index.html

  <Location /api>
      Order allow,deny
      Allow from all
      ProxyPass ${local_node}
      ProxyPassReverse ${local_node}
  </Location>

  <Location /app>
      Order allow,deny
      Allow from all
      ProxyPass ${local_app}/app
      ProxyPassReverse ${local_app}/app
  </Location>
</VirtualHost>

If on v18 the proxy does not work... apache error:

php-apache   | [Thu Dec 15 18:53:58.110169 2022] [proxy:error] [pid 17] (111)Connection refused: AH00957: HTTP: attempt to connect to 192.168.65.2:4200 (host.docker.internal) failed

php-apache   | [Thu Dec 15 18:53:58.110198 2022] [proxy_http:error] [pid 17] [client 172.18.0.1:41480] AH01114: HTTP: failed to make connection to backend: host.docker.internal, referer: http://www.myapp.local/

Again... the node/api proxy still works fine.

I was able to get it to "kinda" work in v18 by setting --host=0.0.0.0 as well... but the hrm websockets were throwing errors in the client... so... after several hours of trying... I could not get this setup to work in v18.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

php-apache   | [Thu Dec 15 18:53:58.110169 2022] [proxy:error] [pid 17] (111)Connection refused: AH00957: HTTP: attempt to connect to 192.168.65.2:4200 (host.docker.internal) failed

php-apache   | [Thu Dec 15 18:53:58.110198 2022] [proxy_http:error] [pid 17] [client 172.18.0.1:41480] AH01114: HTTP: failed to make connection to backend: host.docker.internal, referer: http://www.myapp.local/

Please provide the environment you discovered this bug in (run ng version)

windows 10
node 18.12.1
npm 8.10.0
php:5.6-apache
"@angular/animations": "15.0.0",
"@angular/cdk": "15.0.0",
"@angular/common": "15.0.0",
"@angular/compiler": "15.0.0",
"@angular/core": "15.0.0",
"@angular/forms": "15.0.0",
"@angular/material": "15.0.0",
"@angular/platform-browser": "15.0.0",
"@angular/platform-browser-dynamic": "15.0.0",
"@angular/router": "15.0.0",

Anything else?

Might be webpack-dev-server issue and unrelated to angular in general?

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