Martin Malinda
Martin Malinda
NNuxt
Created by Martin Malinda on 3/13/2025 in #❓・help
/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);
});
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',
},
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 🙏️
14 replies