NuxtN
Nuxt11mo ago
13 replies
Martin Malinda

/server folder

Hi!

I've just migrated my app from Nuxt 2 to Nuxt 3. Lots of things seems to work well, apart from auto registering some server logic.

/plugins/ignoreRouterWarnings.server.ts is not run on the server
/server/middleware/test.ts is not run on the server

I'd be happy to explicitly configure this instead of relying on file conventions but when I tried serverHandlers in nuxt config that completely borked my local server, the server became unknown host

I'm trying to run the simplest logic in /server/middleware/test.ts :

import { defineEventHandler, getRequestURL } from 'h3';

export default defineEventHandler((event) => {
  console.log('Test middleware triggered');
  console.log('Request URL:', getRequestURL(event).pathname);
});


Nothing gets logged in CLI.

SSR otherwise is confirmed to work.

I'm at "nuxt": "3.15.4"

My nitro nuxt config is

  nitro: {
    // devProxy: {
    //   '/api': {
    //     target: process.env.API_HOST || 'https://goout.net',
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, ''),
    //   },
    // },
    logLevel: 5,
    compatibilityDate: '2025-03-13',
  },


I tried commenting out the devProxy thinking it might interfere, but it's not it.

Any tips welcome I've been stuck on this for hours 🙏️
Was this page helpful?