S
SolidJS11mo ago
Kasper

API Proxy in SolidStart

In my application we have a dedicated API backend, on api.example.com, in our vite configuration we have set up a proxy forward with the config below. However when we deply the server with the content from dist/ it dose not use vite to serve the content, but the SolidStart server, are there a way to this "production" to also proxy the requests?
export default defineConfig({
plugins: [solid({ ssr: false })],
ssr: { external: ['@prisma/client'] },
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
target: '[my-link]',
changeOrigin: true,
secure: false,
ws: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
},
},
});
export default defineConfig({
plugins: [solid({ ssr: false })],
ssr: { external: ['@prisma/client'] },
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
target: '[my-link]',
changeOrigin: true,
secure: false,
ws: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
},
},
});
1 Reply
Kasper
KasperOP11mo ago
@˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞
Want results from more Discord servers?
Add your server