Using Nuxt3 behind Apache proxy?
Hi, has anyone experience on getting Nuxt to work behind an Apache proxy?
I've tried anything I can think of but HMR keeps giving errors in my console.
Part of my Virtualhost definition looks like this:
And to handle wss on with Nuxt I have this in nuxt.config:
Apache responds with:
https: attempt to connect to 172.19.0.9:24678 (tapp_nodejs.docker.dev:24678) failed
1 Reply
I finally made it:
I started with a simple setup of just Nuxt3, then built Docker-Compose around it with Apache.
Simple, no https/ssl to keep it simple.
After this I'll have to add ssl, but I'm already happy with this step without ssl:
nuxt.config.ts:
Apache httpd-vhosts.conf:
By setting
vite.server.hmr.path = "ws"
I can now use a location in the apache vhost config.
As I was not able to get apache rewrite
to work, as suggested in many online solutions, using a location was a workaround that works quite well.
I do have a reason.
The team that is managing the servers for us provides all servers with Apache. Mainly for PHP. They cannot be convinced to setup Nginx just for this special case. (I'm happy they let me build a non-PHP website already).
We want our Docker environment to closely resemble our server setup. Thats why I use Apache.
And the dev-task also inside Docker (and build as well to check if that works). Apache in front of it in another container to provide https an OpenId-Connect login.
And the OIDC identity provider in yet another Docker container.
As you can see quite a complex stack that would require quite some work to rebuild in a different way.
Is there another way? π