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:
  <Location  ~ ".*">
      # .* is a wildcard for any location
      ProxyPreserveHost On
      ProxyPass http://tapp_nodejs.docker.dev:3000
      ProxyPassReverse http://tapp_nodejs.docker.dev:3000
  </Location>
  <Location  ~ "/_nuxt/ws">
    RewriteEngine on
    RewriteCond ${HTTP:Upgrade} websocket [NC]
    RewriteCond ${HTTP:Connection} upgrade [NC]
    RewriteRule .* "wss://tapp_nodejs.docker.dev:24678/$1" [P,L]

    ProxyPreserveHost On
    ProxyPass https://tapp_nodejs.docker.dev:24678
    ProxyPassReverse https://tapp_nodejs.docker.dev:24678  
  </Location>


And to handle wss on with Nuxt I have this in nuxt.config:
vite: {
    server: {
      hmr: {
        path: "ws",
        port: 24678,
        server: {
          https: {
            key: readFileSync('docker/certificates/docker.dev.key'),
            cert: readFileSync('docker/certificates/docker.dev.crt'),
            enableTrace: true
          }
        }
      }
    }
  },


Apache responds with: https: attempt to connect to 172.19.0.9:24678 (tapp_nodejs.docker.dev:24678) failed
Was this page helpful?