I’m at my wits end here… I need some help.
So I’m trying to run a simple setup. Apache (or Nginx) in front of a node server and angular app.
Everything works great… UNTIL… if I refresh my browser a few times… I will eventually get (like 1 out of 5 or 6 refreshes) a bunch of pending requests… like apache cant complete the proxy. Once this happens… the site will not load at all for a bit… (perhaps until a timeout kills all the pending requests).
I’ve ran some circles with ChatGPT and wireshark… tried using 127.0.0.1 instead of 0.0.0.0… I dunno. It all is just borked.
If anyone has thoughts… or ran into this before, and has advice. It would be great.
I run app on something like: client1.myapp.local
- node running at
localhost:3333
- angular dev server running at
➜ Local: http://localhost:4200/app/ ➜ Network: http://10.0.0.38:4200/app/ ➜ Network: http://172.18.160.1:4200/app/ ➜ Network: http://172.25.240.1:4200/app/
my apache service:
apache:
container_name: apache
image: httpd:2.4.55
volumes:
## copy app files
- ../../www:/usr/local/apache2/htdocs
- ../../dist/apps/app/browser:/usr/local/apache2/htdocs/app
## copy our local proxies/settings
- ./apache-httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./apache-httpd/virtual-host.conf:/usr/local/apache2/conf/virtual-host.conf
- ./apache-httpd/shared.conf:/usr/local/apache2/conf/shared.conf
ports:
- 80:80
i have a similar one for nginx… tho they both have the issue.
Heres the apache proxy:
# shared.conf
Define local_node "http://host.docker.internal:3333"
Define local_app "http://host.docker.internal:4200"
# virtual-host.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/usr/local/apache2/htdocs"
DirectoryIndex index.html
<Location /api>
Order allow,deny
Allow from all
ProxyPass ${local_node} disablereuse=on
ProxyPassReverse ${local_node}
</Location>
<Location /app>
Order allow,deny
Allow from all
ProxyPass ${local_app}/app disablereuse=on
ProxyPassReverse ${local_app}/app
</Location>
</VirtualHost>