Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

218
Vistas
In Sveltekit & Vite... How to proxy/hide the folder "api"? Works local but not in Vercel

I'm using sveltekit, when the customers request:

https://example.com/v1/contacts

I would like to be pointing internally to:

https://example.com/api/v1/contacts

*This way I can have a much better cleaner organization in my code.

This is my vite.config.js:

import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
    plugins: [sveltekit()],
    server: {
        port: 3001
        proxy: {
            '/v1': {
                target: 'http://127.0.0.1:3001/',
                secure: false,
                changeOrigin: true,
                rewrite: (path) => {
                    return 'api/' + path;
                }
            }
        }
    },
    preview: {
        port: 3001
    }
};

export default config;

It works in localhost, npm run dev, and in localhost when I do npm run preview, but when I upload it to Vercel, it doesn't work. Any ideas?

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda