NuxtN
Nuxt7mo ago
5 replies
reina

Excluding /api/_nuxt_icon from Proxy

i’m working on a Nuxt project where i’ve configured a proxy to forward API requests to an external server. however, i’ve noticed that the /api/_nuxt_icon endpoint, which seems to be used by Nuxt for icon handling, is being proxied to my API web server (http://localhost:3030/api/**) instead of being served by Nuxt itself. this causes issues as the endpoint should be handled locally by Nuxt, not the external API server.

here's my nuxt config file:
export default defineNuxtConfig({
  compatibilityDate: '2025-05-15',
  css: ["~/assets/style.css"],
  devtools: { enabled: true },
  modules: ['@nuxt/ui', '@nuxt/eslint', "@pinia/nuxt"],
  nitro: {
    routeRules: {
      "/api/**": {
        proxy: "http://localhost:3030/api/**",
      },
    },
  },
  appConfig: {
    API_URL: process.env.API_URL,
    API_KEY: process.env.API_KEY,
  },
  runtimeConfig: {
    API_URL: process.env.API_URL,
    API_KEY: process.env.API_KEY,
  }
});


how can i exclude the /api/_nuxt_icon endpoint from being proxied so that it is served by Nuxt’s local server instead of the external API server?
Was this page helpful?